misc (launch script): added a "status" command
This commit is contained in:
parent
3d3d9733ef
commit
8c766858ff
1 changed files with 20 additions and 0 deletions
20
src/sat.sh
20
src/sat.sh
|
|
@ -53,6 +53,8 @@ PYTHONEND
|
|||
APP_NAME="$APP_NAME"
|
||||
PID_FILE="$PID_DIR$APP_NAME_FILE.pid"
|
||||
LOG_FILE="$LOG_DIR$APP_NAME_FILE.log"
|
||||
RUNNING_MSG="$APP_NAME is running"
|
||||
NOT_RUNNING_MSG="$APP_NAME is *NOT* running"
|
||||
|
||||
# if there is one argument which is "stop", then we kill SàT
|
||||
if [ $# -eq 1 ];then
|
||||
|
|
@ -65,6 +67,24 @@ if [ $# -eq 1 ];then
|
|||
elif [ $1 = "fg" ];then
|
||||
echo "Launching $APP_NAME in foreground mode"
|
||||
DAEMON="n"
|
||||
elif [ $1 = "status" ];then
|
||||
if [ -f $PID_FILE ]; then
|
||||
PID=`cat $PID_FILE`
|
||||
ps -p$PID 2>&1 > /dev/null
|
||||
if [ $? = 0 ];then
|
||||
echo "$RUNNING_MSG (pid: $PID)"
|
||||
exit 0
|
||||
else
|
||||
echo "$NOT_RUNNING_MSG, but a pid file is present (bad exit ?): $PID_FILE"
|
||||
exit 2
|
||||
fi
|
||||
else
|
||||
echo "$NOT_RUNNING_MSG"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "bad argument, please use one of (stop, debug, fg, status) or no argument"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue