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
pull/2006/head
skiffer-git 9 months ago committed by GitHub
parent 38f685bd01
commit 39647b33da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -26,8 +26,8 @@
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 if openim::util::is_running_in_container; then
exec > ${DOCKER_LOG_FILE} 2>&1 exec >> ${DOCKER_LOG_FILE} 2>&1
fi 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" openim::color::echo ${COLOR_CYAN} "Environment in the interior of the container"
else else
openim::color::echo ${COLOR_CYAN} "The environment is outside the container" 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 fi
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then

@ -28,7 +28,7 @@ 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.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"

@ -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() { function openim::util::check_process_names_for_stop() {
local all_stopped=true local all_stopped=true
for service in "${OPENIM_ALL_SERVICE_LIBRARIES[@]}"; do 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 exec > ${DOCKER_LOG_FILE} 2>&1
fi fi

Loading…
Cancel
Save