25 lines
547 B
Bash
25 lines
547 B
Bash
#!/usr/bin/env bash
|
|
"$APP" onearg "$@"
|
|
"$APP" exist "$1"
|
|
source "$APP" service_env "$1"
|
|
|
|
echo "[$APP_NAME] Starting '$1' ..."
|
|
if [ "$SERVICE_RUN" = "" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
set +e
|
|
ps -u "$SERVICE_USER"
|
|
if [ "$?" = "0" ]; then
|
|
echo "Service is already running."
|
|
exit 0
|
|
fi
|
|
set -e
|
|
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
|
|
|