mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Shell Check fixes
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
cd "${NETALERTX_APP}" || exit 1
|
||||
max_attempts=50 # 10 seconds total (50 * 0.2s)
|
||||
attempt=0
|
||||
while ps ax | grep -v grep | grep -q python3 && [ $attempt -lt $max_attempts ]; do
|
||||
while pgrep -x python3 >/dev/null && [ $attempt -lt $max_attempts ]; do
|
||||
killall -TERM python3 &>/dev/null
|
||||
sleep 0.2
|
||||
((attempt++))
|
||||
@@ -12,4 +12,5 @@ done
|
||||
killall -KILL python3 &>/dev/null
|
||||
|
||||
echo "Starting python3 $(cat /services/config/python/backend-extra-launch-parameters 2>/dev/null) -m server > ${NETALERTX_LOG}/stdout.log 2> >(tee ${NETALERTX_LOG}/stderr.log >&2)"
|
||||
exec python3 $(cat /services/config/python/backend-extra-launch-parameters 2>/dev/null) -m server > ${NETALERTX_LOG}/stdout.log 2> >(tee ${NETALERTX_LOG}/stderr.log >&2)
|
||||
read -ra EXTRA_PARAMS < <(cat /services/config/python/backend-extra-launch-parameters 2>/dev/null)
|
||||
exec python3 "${EXTRA_PARAMS[@]}" -m server > "${NETALERTX_LOG}/stdout.log" 2> >(tee "${NETALERTX_LOG}/stderr.log" >&2)
|
||||
|
||||
@@ -4,18 +4,22 @@ set -euo pipefail
|
||||
|
||||
crond_pid=""
|
||||
|
||||
# Called externally, but shellcheck does not see that and claims it is unused.
|
||||
# shellcheck disable=SC2329,SC2317
|
||||
cleanup() {
|
||||
status=$?
|
||||
echo "Supercronic stopped! (exit ${status})"
|
||||
}
|
||||
|
||||
# Called externally, but shellcheck does not see that and claims it is unused.
|
||||
# shellcheck disable=SC2329,SC2317
|
||||
forward_signal() {
|
||||
if [[ -n "${crond_pid}" ]]; then
|
||||
kill -TERM "${crond_pid}" 2>/dev/null || true
|
||||
fi
|
||||
}
|
||||
|
||||
while ps ax | grep -v -e grep -e '.sh' | grep crond >/dev/null 2>&1; do
|
||||
while pgrep -x crond >/dev/null 2>&1; do
|
||||
killall crond &>/dev/null
|
||||
sleep 0.2
|
||||
done
|
||||
|
||||
@@ -11,11 +11,15 @@ mkdir -p "${LOG_DIR}" "${RUN_DIR}" "${TMP_DIR}"
|
||||
|
||||
nginx_pid=""
|
||||
|
||||
# Called externally, but shellcheck does not see that and claims it is unused.
|
||||
# shellcheck disable=SC2329,SC2317
|
||||
cleanup() {
|
||||
status=$?
|
||||
echo "nginx stopped! (exit ${status})"
|
||||
}
|
||||
|
||||
# Called externally, but shellcheck does not see that and claims it is unused.
|
||||
# shellcheck disable=SC2329,SC2317
|
||||
forward_signal() {
|
||||
if [[ -n "${nginx_pid}" ]]; then
|
||||
kill -TERM "${nginx_pid}" 2>/dev/null || true
|
||||
@@ -24,12 +28,15 @@ forward_signal() {
|
||||
|
||||
|
||||
# When in devcontainer we must kill any existing nginx processes
|
||||
while ps ax | grep -v -e "grep" -e "nginx.sh" | grep nginx >/dev/null 2>&1; do
|
||||
while pgrep -x nginx >/dev/null 2>&1; do
|
||||
killall nginx &>/dev/null || true
|
||||
sleep 0.2
|
||||
done
|
||||
|
||||
TEMP_CONFIG_FILE=$(mktemp "${TMP_DIR}/netalertx.conf.XXXXXX")
|
||||
|
||||
# Shell check doesn't recognize envsubst variables
|
||||
# shellcheck disable=SC2016
|
||||
if envsubst '${LISTEN_ADDR} ${PORT}' < "${SYSTEM_NGINX_CONFIG_TEMPLATE}" > "${TEMP_CONFIG_FILE}" 2>/dev/null; then
|
||||
mv "${TEMP_CONFIG_FILE}" "${SYSTEM_SERVICES_ACTIVE_CONFIG_FILE}"
|
||||
else
|
||||
|
||||
@@ -3,18 +3,22 @@ set -euo pipefail
|
||||
|
||||
php_fpm_pid=""
|
||||
|
||||
# Called externally, but shellcheck does not see that and claims it is unused.
|
||||
# shellcheck disable=SC2329,SC2317
|
||||
cleanup() {
|
||||
status=$?
|
||||
echo "php-fpm stopped! (exit ${status})"
|
||||
}
|
||||
|
||||
# Called externally, but shellcheck does not see that and claims it is unused.
|
||||
# shellcheck disable=SC2329,SC2317
|
||||
forward_signal() {
|
||||
if [[ -n "${php_fpm_pid}" ]]; then
|
||||
kill -TERM "${php_fpm_pid}" 2>/dev/null || true
|
||||
fi
|
||||
}
|
||||
|
||||
while ps ax | grep -v grep | grep php-fpm83 >/dev/null; do
|
||||
while pgrep -x php-fpm83 >/dev/null; do
|
||||
killall php-fpm83 &>/dev/null
|
||||
sleep 0.2
|
||||
done
|
||||
@@ -27,5 +31,6 @@ echo "Starting /usr/sbin/php-fpm83 -y \"${PHP_FPM_CONFIG_FILE}\" -F >>\"${LOG_AP
|
||||
php_fpm_pid=$!
|
||||
|
||||
wait "${php_fpm_pid}"
|
||||
exit_status=$?
|
||||
echo -ne " done"
|
||||
exit $?
|
||||
exit $exit_status
|
||||
Reference in New Issue
Block a user