mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-05 20:11:14 +08:00
Optimizing Docker Log Output (#2018)
* Optimize script logs * Optimizing Docker Log Output Detection * Optimizing Docker Log Output Detection * Optimizing Docker Log Output Detection * Optimizing Docker Log Output Detection * Optimizing Docker Log Output Detection * Optimizing Docker Log Output Detection * Optimizing Docker Log Output Detection * Optimizing Docker Log Output Detection * Optimizing Docker Log Output Detection * Optimizing Docker Log Output Detection * Optimizing Docker Log Output Detection * Optimizing Docker Log Output Detection
This commit is contained in:
parent
38f685bd01
commit
39647b33da
@ -26,8 +26,8 @@
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||
|
||||
if grep -q docker /proc/1/cgroup; then
|
||||
exec > ${DOCKER_LOG_FILE} 2>&1
|
||||
if openim::util::is_running_in_container; then
|
||||
exec >> ${DOCKER_LOG_FILE} 2>&1
|
||||
fi
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ if grep -qE 'docker|kubepods' /proc/1/cgroup || [ -f /.dockerenv ]; then
|
||||
openim::color::echo ${COLOR_CYAN} "Environment in the interior of the container"
|
||||
else
|
||||
openim::color::echo ${COLOR_CYAN} "The environment is outside the container"
|
||||
openim::util::check_ports ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]} || return 0
|
||||
openim::util::check_ports ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]}
|
||||
fi
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
|
@ -28,7 +28,7 @@ fi
|
||||
LOG_FILE="${OPENIM_OUTPUT}/logs/openim-$(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"
|
||||
|
||||
DOCKER_LOG_FILE="${OPENIM_OUTPUT}/logs/openim-docker.log"
|
||||
if [[ ! -d "${OPENIM_OUTPUT}/logs" ]]; then
|
||||
mkdir -p "${OPENIM_OUTPUT}/logs"
|
||||
touch "$LOG_FILE"
|
||||
|
@ -2866,6 +2866,15 @@ function openim::util::gen_os_arch() {
|
||||
|
||||
|
||||
|
||||
function openim::util::is_running_in_container() {
|
||||
if grep -qE 'docker|kubepods' /proc/1/cgroup || [ -f /.dockerenv ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function openim::util::check_process_names_for_stop() {
|
||||
local all_stopped=true
|
||||
for service in "${OPENIM_ALL_SERVICE_LIBRARIES[@]}"; do
|
||||
|
@ -62,7 +62,7 @@ function execute_start_scripts() {
|
||||
|
||||
|
||||
|
||||
if grep -q docker /proc/1/cgroup; then
|
||||
if openim::util::is_running_in_container; then
|
||||
exec > ${DOCKER_LOG_FILE} 2>&1
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user