feat: Optimize openim scripts and standard output logs (#1866)

* feat: add component check func

* fix: fix the outpu error

* fix: fix the stderr outpu

* fix: fix the component check func

* fix: fix the error

* fix: fix the output error

* fix: del the disruptions code

* fix the log output format

* fix: fix the tools version

* fix: fix the cycle detection

* fix: fix the error

* fix: fix the flag

* fix: add mongo ping detection

* fix: fix the tools pkg version

* fix: del the err

* feat: support openim readme docs

Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>

* feat: support openim readme docs

Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>

* feat: support openim readme docs

Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>

* fix: fix the minio nil error

* fix: del the repeated wrap and add err print

* fix: fix this bug scripts

* Revert "Check"

---------

Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>
Co-authored-by: luhaoling <2198702716@qq.com>
This commit is contained in:
Xinwei Xiong
2024-02-02 21:59:12 +08:00
committed by GitHub
parent af878a96cf
commit 854f8dbd2f
30 changed files with 146 additions and 67 deletions
+19 -8
View File
@@ -360,7 +360,9 @@ openim::util::check_ports() {
# If any of the processes is not running, return a status of 1.
if [[ ${#not_started[@]} -ne 0 ]]; then
echo "++++ OpenIM Log >> cat ${LOG_FILE}"
openim::color::echo $COLOR_RED " OpenIM Stdout Log >> cat ${LOG_FILE}"
openim::color::echo $COLOR_RED " OpenIM Stderr Log >> cat ${STDERR_LOG_FILE}"
cat "$TMP_LOG_FILE" | awk '{print "\033[31m" $0 "\033[0m"}'
return 1
else
openim::log::success "All specified processes are running."
@@ -444,9 +446,12 @@ openim::util::check_process_names() {
# Return status
if [[ ${#not_started[@]} -ne 0 ]]; then
echo "++++ OpenIM Log >> cat ${LOG_FILE}"
openim::color::echo $COLOR_RED " OpenIM Stdout Log >> cat ${LOG_FILE}"
openim::color::echo $COLOR_RED " OpenIM Stderr Log >> cat ${STDERR_LOG_FILE}"
cat "$TMP_LOG_FILE" | awk '{print "\033[31m" $0 "\033[0m"}'
return 1
else
echo ""
openim::log::success "All processes are running."
return 0
fi
@@ -1536,12 +1541,12 @@ openim::util::check_ports() {
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if command -v ss > /dev/null 2>&1; then
info=$(ss -ltnp | grep ":$port" || true)
echo "!!!!!!!!!!! port=$port"
echo "!!!!!!!!!!! info=$info"
openim::color::echo $COLOR_RED "!!!!!!!! port=$port"
openim::color::echo $COLOR_RED "!!!!!!!! info=$info"
else
info=$(netstat -ltnp | grep ":$port" || true)
echo "!!!!!!!!!!! port=$port"
echo "!!!!!!!!!!! info=$info"
openim::color::echo $COLOR_RED "!!!!!!!! port=$port"
openim::color::echo $COLOR_RED "!!!!!!!! info=$info"
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
# For macOS, use lsof
@@ -1594,7 +1599,10 @@ openim::util::check_ports() {
# If any of the processes is not running, return a status of 1.
if [[ ${#not_started[@]} -ne 0 ]]; then
echo "++++ OpenIM Log >> cat ${LOG_FILE}"
openim::color::echo $COLOR_RED " OpenIM Stdout Log >> cat ${LOG_FILE}"
openim::color::echo $COLOR_RED " OpenIM Stderr Log >> cat ${STDERR_LOG_FILE}"
echo ""
cat "$TMP_LOG_FILE" | awk '{print "\033[31m" $0 "\033[0m"}'
return 1
else
openim::log::success "All specified processes are running."
@@ -1678,9 +1686,12 @@ openim::util::check_process_names() {
# Return status
if [[ ${#not_started[@]} -ne 0 ]]; then
echo "++++ OpenIM Log >> cat ${LOG_FILE}"
openim::color::echo $COLOR_RED " OpenIM Stdout Log >> cat ${LOG_FILE}"
openim::color::echo $COLOR_RED " OpenIM Stderr Log >> cat ${STDERR_LOG_FILE}"
cat "$TMP_LOG_FILE" | awk '{print "\033[31m" $0 "\033[0m"}'
return 1
else
echo ""
openim::log::success "All processes are running."
return 0
fi