Completes POCONSOLE-70. finishes startup scripts for twisted production server

This commit is contained in:
Patrick McDonagh
2016-11-22 14:41:42 -06:00
parent 670b9a4191
commit fbfa9eb91a
3 changed files with 7 additions and 9 deletions

View File

@@ -11,16 +11,17 @@
SCRIPT=/root/www/start.sh
RUNAS=poconsole
PIDFILE=/var/run/datalogger.pid
PIDFILE=/root/datalogger.pid
LOGFILE=/root/datalogger.log
start() {
if [ -f "$PIDFILE" ] && kill -0 $(cat "$PIDFILE"); then
if [ -f "$PIDFILE" ] && kill -0 $(cat $PIDFILE); then
echo 'Service already running' >&2
return 1
fi
echo 'Starting service…' >&2
local CMD="$SCRIPT & echo \$!"
su -c "$CMD" $RUNAS
local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!"
su -c "$CMD" $RUNAS > /dev/null
echo 'Service started' >&2
}
@@ -41,6 +42,7 @@ uninstall() {
if [ "$SURE" = "yes" ]; then
stop
rm -f "$PIDFILE"
echo "Notice: log file is not be removed: '$LOGFILE'" >&2
update-rc.d -f datalogger remove
rm -fv "$0"
fi

View File

@@ -1,5 +1,5 @@
#!/bin/bash
OLDDIR=$PWD
cd /root/www
twistd --pidfile=/root/twistd.pid web --https=5000 --wsgi app.app -c app/hplumberjack.crt -k app/hplumberjack.key
twistd --pidfile=/root/datalogger.pid web --https=5000 --wsgi app.app -c app/hplumberjack.crt -k app/hplumberjack.key
cd $OLDDIR

View File

@@ -1,4 +0,0 @@
#!/bin/bash
kill $(cat /root/twistd.pid)
mv /root/twistd.pid /root/twistd.pid.old