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
532f6acb5d
commit
9c143852cc
@ -51,8 +51,9 @@ function openim::crontask::start() {
|
|||||||
openim::log::status "Start OpenIM Cron, path: ${OPENIM_CRONTASK_BINARY}"
|
openim::log::status "Start OpenIM Cron, path: ${OPENIM_CRONTASK_BINARY}"
|
||||||
|
|
||||||
openim::log::status "start cron_task process, path: ${OPENIM_CRONTASK_BINARY}"
|
openim::log::status "start cron_task process, path: ${OPENIM_CRONTASK_BINARY}"
|
||||||
|
#nohup ${OPENIM_CRONTASK_BINARY} -c ${OPENIM_PUSH_CONFIG} >> ${LOG_FILE} 2> >(tee -a "${STDERR_LOG_FILE}" "$TMP_LOG_FILE" >&2) &
|
||||||
nohup ${OPENIM_CRONTASK_BINARY} -c ${OPENIM_PUSH_CONFIG} >> ${LOG_FILE} 2> >(tee -a "${STDERR_LOG_FILE}" "$TMP_LOG_FILE" >&2) &
|
cmd= "${OPENIM_CRONTASK_BINARY} -c ${OPENIM_PUSH_CONFIG}"
|
||||||
|
nohup ${cmd} >> "${LOG_FILE}" 2> >(tee -a "$TMP_LOG_FILE" | while read line; do echo -e "\e[31m${line}\e[0m"; done >&2) >/dev/null &
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,8 +61,10 @@ function openim::msggateway::start() {
|
|||||||
if [[ -n "${MSG_GATEWAY_PROM_PORTS_ARRAY[$i]}" ]]; then
|
if [[ -n "${MSG_GATEWAY_PROM_PORTS_ARRAY[$i]}" ]]; then
|
||||||
PROMETHEUS_PORT_OPTION="--prometheus_port ${MSG_GATEWAY_PROM_PORTS_ARRAY[$i]}"
|
PROMETHEUS_PORT_OPTION="--prometheus_port ${MSG_GATEWAY_PROM_PORTS_ARRAY[$i]}"
|
||||||
fi
|
fi
|
||||||
|
cmd="${OPENIM_MSGGATEWAY_BINARY} --port ${OPENIM_MSGGATEWAY_PORTS_ARRAY[$i]} --ws_port ${OPENIM_WS_PORTS_ARRAY[$i]} $PROMETHEUS_PORT_OPTION -c ${OPENIM_MSGGATEWAY_CONFIG}"
|
||||||
|
nohup ${cmd} >> "${LOG_FILE}" 2> >(tee -a "$TMP_LOG_FILE" | while read line; do echo -e "\e[31m${line}\e[0m"; done >&2) >/dev/null &
|
||||||
|
# nohup ${OPENIM_MSGGATEWAY_BINARY} --port ${OPENIM_MSGGATEWAY_PORTS_ARRAY[$i]} --ws_port ${OPENIM_WS_PORTS_ARRAY[$i]} $PROMETHEUS_PORT_OPTION -c ${OPENIM_MSGGATEWAY_CONFIG} >> ${LOG_FILE} 2> >(tee -a "${STDERR_LOG_FILE}" "$TMP_LOG_FILE" >&2) &
|
||||||
|
|
||||||
nohup ${OPENIM_MSGGATEWAY_BINARY} --port ${OPENIM_MSGGATEWAY_PORTS_ARRAY[$i]} --ws_port ${OPENIM_WS_PORTS_ARRAY[$i]} $PROMETHEUS_PORT_OPTION -c ${OPENIM_MSGGATEWAY_CONFIG} >> ${LOG_FILE} 2> >(tee -a "${STDERR_LOG_FILE}" "$TMP_LOG_FILE" >&2) &
|
|
||||||
done
|
done
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,10 +57,11 @@ function openim::msgtransfer::start() {
|
|||||||
openim::util::stop_services_on_ports ${PROMETHEUS_MSG_TRANSFER_PORT}
|
openim::util::stop_services_on_ports ${PROMETHEUS_MSG_TRANSFER_PORT}
|
||||||
PROMETHEUS_PORT_OPTION="--prometheus_port ${PROMETHEUS_MSG_TRANSFER_PORT}"
|
PROMETHEUS_PORT_OPTION="--prometheus_port ${PROMETHEUS_MSG_TRANSFER_PORT}"
|
||||||
fi
|
fi
|
||||||
nohup ${OPENIM_MSGTRANSFER_BINARY} ${PROMETHEUS_PORT_OPTION} -c ${OPENIM_MSGTRANSFER_CONFIG} -n ${i} >> ${LOG_FILE} 2> >(tee -a "${STDERR_LOG_FILE}" "$TMP_LOG_FILE" >&2) &
|
cmd="${OPENIM_MSGTRANSFER_BINARY} ${PROMETHEUS_PORT_OPTION} -c ${OPENIM_MSGTRANSFER_CONFIG} -n ${i}"
|
||||||
|
nohup ${cmd} >> "${LOG_FILE}" 2> >(tee -a "$TMP_LOG_FILE" | while read line; do echo -e "\e[31m${line}\e[0m"; done >&2) >/dev/null &
|
||||||
|
#nohup ${OPENIM_MSGTRANSFER_BINARY} ${PROMETHEUS_PORT_OPTION} -c ${OPENIM_MSGTRANSFER_CONFIG} -n ${i} >> ${LOG_FILE} 2> >(tee -a "${STDERR_LOG_FILE}" "$TMP_LOG_FILE" >&2) &
|
||||||
done
|
done
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function openim::msgtransfer::check() {
|
function openim::msgtransfer::check() {
|
||||||
|
|||||||
@ -71,7 +71,9 @@ function openim::push::start() {
|
|||||||
|
|
||||||
for (( i=0; i<${#OPENIM_PUSH_PORTS_ARRAY[@]}; i++ )); do
|
for (( i=0; i<${#OPENIM_PUSH_PORTS_ARRAY[@]}; i++ )); do
|
||||||
openim::log::info "start push process, port: ${OPENIM_PUSH_PORTS_ARRAY[$i]}, prometheus port: ${PUSH_PROM_PORTS_ARRAY[$i]}"
|
openim::log::info "start push process, port: ${OPENIM_PUSH_PORTS_ARRAY[$i]}, prometheus port: ${PUSH_PROM_PORTS_ARRAY[$i]}"
|
||||||
nohup ${OPENIM_PUSH_BINARY} --port ${OPENIM_PUSH_PORTS_ARRAY[$i]} -c ${OPENIM_PUSH_CONFIG} --prometheus_port ${PUSH_PROM_PORTS_ARRAY[$i]} >> ${LOG_FILE} 2> >(tee -a "${STDERR_LOG_FILE}" "$TMP_LOG_FILE" >&2) &
|
cmd="${OPENIM_PUSH_BINARY} --port ${OPENIM_PUSH_PORTS_ARRAY[$i]} -c ${OPENIM_PUSH_CONFIG} --prometheus_port ${PUSH_PROM_PORTS_ARRAY[$i]}"
|
||||||
|
nohup ${cmd} >> "${LOG_FILE}" 2> >(tee -a "$TMP_LOG_FILE" | while read line; do echo -e "\e[31m${line}\e[0m"; done >&2) >/dev/null &
|
||||||
|
#nohup ${OPENIM_PUSH_BINARY} --port ${OPENIM_PUSH_PORTS_ARRAY[$i]} -c ${OPENIM_PUSH_CONFIG} --prometheus_port ${PUSH_PROM_PORTS_ARRAY[$i]} >> ${LOG_FILE} 2> >(tee -a "${STDERR_LOG_FILE}" "$TMP_LOG_FILE" >&2) &
|
||||||
done
|
done
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|||||||
@ -165,7 +165,8 @@ function openim::rpc::start_service() {
|
|||||||
printf "Specifying prometheus port: %s\n" "${prometheus_port}"
|
printf "Specifying prometheus port: %s\n" "${prometheus_port}"
|
||||||
cmd="${cmd} --prometheus_port ${prometheus_port}"
|
cmd="${cmd} --prometheus_port ${prometheus_port}"
|
||||||
fi
|
fi
|
||||||
nohup ${cmd} >> "${LOG_FILE}" 2> >(tee -a "${STDERR_LOG_FILE}" "$TMP_LOG_FILE" >&2) &
|
#nohup ${cmd} >> "${LOG_FILE}" 2> >(tee -a "${STDERR_LOG_FILE}" "$TMP_LOG_FILE" >&2) &
|
||||||
|
nohup ${cmd} >> "${LOG_FILE}" 2> >(tee -a "$TMP_LOG_FILE" | while read line; do echo -e "\e[31m${line}\e[0m"; done >&2) >/dev/null &
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -237,4 +237,9 @@ function openim::log::test_log() {
|
|||||||
openim::log::error_exit "openim::log::error_exit"
|
openim::log::error_exit "openim::log::error_exit"
|
||||||
}
|
}
|
||||||
|
|
||||||
# openim::log::test_log
|
# openim::log::test_log
|
||||||
|
|
||||||
|
function openim::log::print_blue() {
|
||||||
|
echo -e "\033[0;36m$1\033[0m"
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -69,7 +69,7 @@ fi
|
|||||||
|
|
||||||
"${OPENIM_ROOT}"/scripts/init-config.sh --skip
|
"${OPENIM_ROOT}"/scripts/init-config.sh --skip
|
||||||
|
|
||||||
echo "You need to start the following scripts in order: ${OPENIM_SERVER_SCRIPTARIES[@]}"
|
openim::log::print_blue "Execute the following script in sequence: ${OPENIM_SERVER_SCRIPTARIES[@]}"
|
||||||
|
|
||||||
|
|
||||||
# TODO Prelaunch tools, simple for now, can abstract functions later
|
# TODO Prelaunch tools, simple for now, can abstract functions later
|
||||||
@ -81,7 +81,7 @@ ${TOOLS_START_SCRIPTS_PATH} openim::tools::pre-start
|
|||||||
|
|
||||||
result=$("${OPENIM_ROOT}"/scripts/stop-all.sh)
|
result=$("${OPENIM_ROOT}"/scripts/stop-all.sh)
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "+++ cat openim log file >>> ${LOG_FILE}"
|
openim::log::error "View the error logs from this startup. ${LOG_FILE} \n"
|
||||||
openim::log::error "Some programs have not exited; the start process is aborted .\n $result"
|
openim::log::error "Some programs have not exited; the start process is aborted .\n $result"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user