Better Ubuntu script
This commit is contained in:
1 parent
4e2b511c06
commit
f2988e6d62
1 file changed
+12
-9
+12
-9
@@ -14,13 +14,14 @@
|
|||||||
|
|
||||||
############### EDIT ME ##################
|
############### EDIT ME ##################
|
||||||
# path to app
|
# path to app
|
||||||
APP_PATH=/usr/local/sbin/couchpotato
|
APP_PATH=/usr/local/sbin/CouchPotatoServer/
|
||||||
|
|
||||||
# path to python bin
|
# path to python bin
|
||||||
DAEMON=/usr/bin/python
|
DAEMON=/usr/bin/python
|
||||||
|
|
||||||
# startup args
|
# Path to store PID file
|
||||||
DAEMON_OPTS=" CouchPotato.py"
|
PID_FILE=/var/run/couchpotato/server.pid
|
||||||
|
PID_PATH=$(dirname $PID_FILE)
|
||||||
|
|
||||||
# script name
|
# script name
|
||||||
NAME=couchpotato
|
NAME=couchpotato
|
||||||
@@ -31,7 +32,8 @@ DESC=CouchPotato
|
|||||||
# user
|
# user
|
||||||
RUN_AS=root
|
RUN_AS=root
|
||||||
|
|
||||||
PID_FILE=/var/run/couchpotato.pid
|
# startup args
|
||||||
|
DAEMON_OPTS=" CouchPotato.py --daemon --pid_file=${PID_FILE}"
|
||||||
|
|
||||||
############### END EDIT ME ##################
|
############### END EDIT ME ##################
|
||||||
|
|
||||||
@@ -42,18 +44,19 @@ set -e
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
echo "Starting $DESC"
|
echo "Starting $DESC"
|
||||||
start-stop-daemon -d $APP_PATH -c $RUN_AS --start --background --pidfile $PID_FILE --make-pidfile --exec $DAEMON -- $DAEMON_OPTS
|
rm -rf $PID_PATH || return 1
|
||||||
|
install -d --mode=0755 -o $RUN_AS -g $RUN_AS $PID_PATH || return 1
|
||||||
|
start-stop-daemon -d $APP_PATH -c $RUN_AS --start --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
echo "Stopping $DESC"
|
echo "Stopping $DESC"
|
||||||
start-stop-daemon --stop --pidfile $PID_FILE
|
start-stop-daemon --stop --pidfile $PID_FILE --retry 15
|
||||||
;;
|
;;
|
||||||
|
|
||||||
restart|force-reload)
|
restart|force-reload)
|
||||||
echo "Restarting $DESC"
|
echo "Restarting $DESC"
|
||||||
start-stop-daemon --stop --pidfile $PID_FILE
|
start-stop-daemon --stop --pidfile $PID_FILE --retry 15
|
||||||
sleep 15
|
start-stop-daemon -d $APP_PATH -c $RUN_AS --start --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS
|
||||||
start-stop-daemon -d $APP_PATH -c $RUN_AS --start --background --pidfile $PID_FILE --make-pidfile --exec $DAEMON -- $DAEMON_OPTS
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
N=/etc/init.d/$NAME
|
N=/etc/init.d/$NAME
|
||||||
|
|||||||
Reference in new issue
Block a user