mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-03 02:42:19 +08:00
Optimize script logs
This commit is contained in:
parent
13d0883507
commit
d09eccd117
@ -26,6 +26,11 @@
|
|||||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||||
|
|
||||||
|
if grep -q docker /proc/1/cgroup; then
|
||||||
|
exec > ${DOCKER_LOG_FILE} 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
OPENIM_VERBOSE=4
|
OPENIM_VERBOSE=4
|
||||||
|
|
||||||
openim::log::info "\n# Begin to check all openim service"
|
openim::log::info "\n# Begin to check all openim service"
|
||||||
|
|||||||
@ -30,8 +30,4 @@ trap 'openim::util::onCtrlC' INT
|
|||||||
|
|
||||||
"${OPENIM_ROOT}"/scripts/start-all.sh
|
"${OPENIM_ROOT}"/scripts/start-all.sh
|
||||||
|
|
||||||
sleep 5
|
tail -f ${DOCKER_LOG_FILE}
|
||||||
|
|
||||||
"${OPENIM_ROOT}"/scripts/check-all.sh
|
|
||||||
|
|
||||||
tail -f ${LOG_FILE}
|
|
||||||
|
|||||||
@ -28,12 +28,14 @@ fi
|
|||||||
LOG_FILE="${OPENIM_OUTPUT}/logs/openim-$(date '+%Y%m%d').log"
|
LOG_FILE="${OPENIM_OUTPUT}/logs/openim-$(date '+%Y%m%d').log"
|
||||||
STDERR_LOG_FILE="${OPENIM_OUTPUT}/logs/openim-error-$(date '+%Y%m%d').log"
|
STDERR_LOG_FILE="${OPENIM_OUTPUT}/logs/openim-error-$(date '+%Y%m%d').log"
|
||||||
TMP_LOG_FILE="${OPENIM_OUTPUT}/logs/openim-tmp-$(date '+%Y%m%d').log"
|
TMP_LOG_FILE="${OPENIM_OUTPUT}/logs/openim-tmp-$(date '+%Y%m%d').log"
|
||||||
|
DOCKER_LOG_FILE="${OPENIM_OUTPUT}/logs/openim-docker-$(date '+%Y%m%d').log"
|
||||||
|
|
||||||
if [[ ! -d "${OPENIM_OUTPUT}/logs" ]]; then
|
if [[ ! -d "${OPENIM_OUTPUT}/logs" ]]; then
|
||||||
mkdir -p "${OPENIM_OUTPUT}/logs"
|
mkdir -p "${OPENIM_OUTPUT}/logs"
|
||||||
touch "$LOG_FILE"
|
touch "$LOG_FILE"
|
||||||
touch "$STDERR_LOG_FILE"
|
touch "$STDERR_LOG_FILE"
|
||||||
touch "$TMP_LOG_FILE"
|
touch "$TMP_LOG_FILE"
|
||||||
|
touch "$DOCKER_LOG_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Define the logging function
|
# Define the logging function
|
||||||
|
|||||||
@ -17,12 +17,17 @@
|
|||||||
#FIXME The full names of the shell scripts that need to be started are placed in the `need_to_start_server_shell` array.
|
#FIXME The full names of the shell scripts that need to be started are placed in the `need_to_start_server_shell` array.
|
||||||
|
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Function to execute the scripts.
|
# Function to execute the scripts.
|
||||||
function execute_start_scripts() {
|
function execute_start_scripts() {
|
||||||
for script_path in "${OPENIM_SERVER_SCRIPT_START_LIST[@]}"; do
|
for script_path in "${OPENIM_SERVER_SCRIPT_START_LIST[@]}"; do
|
||||||
@ -57,6 +62,9 @@ function execute_start_scripts() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if grep -q docker /proc/1/cgroup; then
|
||||||
|
exec > ${DOCKER_LOG_FILE} 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user