diff --git a/rootfs/usr/local/bin/entrypoint.sh b/rootfs/usr/local/bin/entrypoint.sh index 708e22c..f880601 100755 --- a/rootfs/usr/local/bin/entrypoint.sh +++ b/rootfs/usr/local/bin/entrypoint.sh @@ -31,9 +31,9 @@ __exec_command() { return ${exitCode:-$?} } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -__pcheck() { [ -n "$(which pgrep 2>/dev/null)" ] && pgrep -x "$1" || return 1; } +__curl() { curl -q -LSsf -o /dev/null "$@" 2>/dev/null || return 10; } __find() { find "$1" -mindepth 1 -type ${2:-f,d} 2>/dev/null | grep '^' || return 10; } -__curl() { curl -q -LSsf -o /dev/null -s -w "200" "$@" 2>/dev/null || return 10; } +__pcheck() { [ -n "$(which pgrep 2>/dev/null)" ] && pgrep -x "$1" &>/dev/null || return 10; } __pgrep() { __pcheck "${1:-$SERVICE_NAME}" || ps aux 2>/dev/null | grep -Fw " ${1:-$SERVICE_NAME}" | grep -qv ' grep' || return 10; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - __certbot() { @@ -45,7 +45,7 @@ __certbot() { # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - __heath_check() { status=0 health="Good" - start-soft.sh healthcheck || status=$((status + 1)) + start-soft.sh healthcheck &>/dev/null || status=$((status + 1)) [ "$status" -eq 0 ] || health="Errors reported see docker logs --follow $CONTAINER_NAME" echo "$(uname -s) $(uname -m) is running and the health is: $health" return ${status:-$?} diff --git a/rootfs/usr/local/bin/start-soft.sh b/rootfs/usr/local/bin/start-soft.sh index 404a14a..a500c75 100755 --- a/rootfs/usr/local/bin/start-soft.sh +++ b/rootfs/usr/local/bin/start-soft.sh @@ -19,9 +19,9 @@ # @@Template : other/start-service # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Set functions -__pcheck() { [ -n "$(which pgrep 2>/dev/null)" ] && pgrep -x "$1" || return 1; } +__curl() { curl -q -LSsf -o /dev/null "$@" 2>/dev/null || return 10; } __find() { find "$1" -mindepth 1 -type ${2:-f,d} 2>/dev/null | grep '^' || return 10; } -__curl() { curl -q -LSsf -o /dev/null -s -w "200" "$@" 2>/dev/null || return 10; } +__pcheck() { [ -n "$(which pgrep 2>/dev/null)" ] && pgrep -x "$1" &>/dev/null || return 10; } __pgrep() { __pcheck "$1" || ps aux 2>/dev/null | grep -Fw " $1" | grep -qv ' grep' || return 10; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - __certbot() { @@ -33,10 +33,9 @@ __certbot() { # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - __heath_check() { status=0 health="Good" - __pgrep ${1:-} || status=$((status + 1)) - #__curl "http://localhost:$HTTP_PORT/server-health" || status=$((status + 1)) + __pgrep ${1:-} &>/dev/null || status=$((status + 1)) + #__curl "http://localhost:$SERVICE_PORT/server-health" || status=$((status + 1)) [ "$status" -eq 0 ] || health="Errors reported see docker logs --follow $CONTAINER_NAME" - echo "$(uname -s) $(uname -m) is running and the health is: $health" return ${status:-$?} } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -