From 4d24f97bafdee02ded34b65601ab57f0fe9dd12b Mon Sep 17 00:00:00 2001 From: Fierelier Date: Tue, 23 Apr 2024 15:13:08 +0200 Subject: [PATCH] Better debug command --- app/bin/debug | 10 ++-------- app/bin/start | 14 ++++++++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/bin/debug b/app/bin/debug index b928d86..6855ee6 100644 --- a/app/bin/debug +++ b/app/bin/debug @@ -1,9 +1,3 @@ #!/usr/bin/env bash -"$APP" onearg "$@" -"$APP" exist "$1" -source "$APP" service_env "$1" -if ! [ "$SERVICE_RUN" = "" ]; then - SERVICE_RUN_RAW="cd \"$SERVICE_CD\"; echo \"* pwd: \$PWD\"; exec ${SERVICE_RUN//"/\\"}" - echo "* bash: $SERVICE_RUN_RAW" - gosu "$SERVICE_USER" bash -c "$SERVICE_RUN_RAW" -fi +SERVICE_DEBUG=1 +source "$APP" start "$1" diff --git a/app/bin/start b/app/bin/start index 82d7a56..17d1c50 100644 --- a/app/bin/start +++ b/app/bin/start @@ -21,11 +21,17 @@ if [ "$SERVICE_RUN" = "" ]; then exit 0 fi -SERVICE_RUN_RAW="cd \"$SERVICE_CD\"; exec ${SERVICE_RUN//"/\\"}" -if [ "$SERVICE_SCREEN" = "1" ]; then - screen -dmS "$SERVICE_SCREEN_NAME" gosu "$SERVICE_USER" bash -c "$SERVICE_RUN_RAW" +if [ "$SERVICE_DEBUG" = "1" ]; then + SERVICE_RUN_RAW="cd \"$SERVICE_CD\"; echo \"* pwd: \$PWD\"; exec ${SERVICE_RUN//"/\\"}" + echo "* bash: $SERVICE_RUN_RAW" + exec gosu "$SERVICE_USER" bash -c "$SERVICE_RUN_RAW" else - gosu "$SERVICE_USER" nohup bash -c "$SERVICE_RUN_RAW" > /dev/null 2>&1 & + SERVICE_RUN_RAW="cd \"$SERVICE_CD\"; exec ${SERVICE_RUN//"/\\"}" + if [ "$SERVICE_SCREEN" = "1" ]; then + screen -dmS "$SERVICE_SCREEN_NAME" gosu "$SERVICE_USER" bash -c "$SERVICE_RUN_RAW" + else + gosu "$SERVICE_USER" nohup bash -c "$SERVICE_RUN_RAW" > /dev/null 2>&1 & + fi fi if [ -e "$APP_SERVICES/$1/await" ]; then