Ubuntu init script /etc/default
This commit is contained in:
1 parent
bba18d8bc9
commit
f0e7795b9b
2 files changed
+37
-35
No files matched your search
+32
-35
@@ -12,59 +12,56 @@
|
|||||||
# Description: starts instance of CouchPotato using start-stop-daemon
|
# Description: starts instance of CouchPotato using start-stop-daemon
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
############### EDIT ME ##################
|
|
||||||
# path to app
|
|
||||||
APP_PATH=/usr/local/sbin/CouchPotatoServer/
|
|
||||||
|
|
||||||
# user
|
|
||||||
RUN_AS=YOUR_USERNAME_HERE
|
|
||||||
|
|
||||||
# path to python bin
|
|
||||||
DAEMON=/usr/bin/python
|
|
||||||
|
|
||||||
# Path to store PID file
|
|
||||||
PID_FILE=/var/run/couchpotato.pid
|
|
||||||
|
|
||||||
# script name
|
|
||||||
NAME=couchpotato
|
|
||||||
|
|
||||||
# app name
|
|
||||||
DESC=CouchPotato
|
|
||||||
|
|
||||||
# startup args
|
|
||||||
DAEMON_OPTS=" CouchPotato.py --daemon --pid_file=${PID_FILE}"
|
|
||||||
|
|
||||||
############### END EDIT ME ##################
|
|
||||||
|
|
||||||
# Check for existance of defaults file
|
# Check for existance of defaults file
|
||||||
# and utilze if available
|
# and utilze if available
|
||||||
if [ -e "/etc/default/couchpotato" ]
|
if [ -f /etc/default/couchpotato ]; then
|
||||||
then
|
|
||||||
unset DAEMON_OPTS
|
|
||||||
. /etc/default/couchpotato
|
. /etc/default/couchpotato
|
||||||
|
else
|
||||||
|
echo "/etc/default/couchpotato not found using default settings.";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
test -x $DAEMON || exit 0
|
# Script name
|
||||||
|
NAME=couchpotato
|
||||||
|
|
||||||
|
# App name
|
||||||
|
DESC=CouchPotato
|
||||||
|
|
||||||
|
# Path to app root
|
||||||
|
CP_APP_PATH=${APP_PATH-/usr/local/sbin/CouchPotatoServer/}
|
||||||
|
|
||||||
|
# User to run CP as
|
||||||
|
CP_RUN_AS=${RUN_AS-root}
|
||||||
|
|
||||||
|
# Path to python bin
|
||||||
|
CP_DAEMON=${DAEMON_PATH-/usr/bin/python}
|
||||||
|
|
||||||
|
# Path to store PID file
|
||||||
|
CP_PID_FILE=${PID_FILE-/var/run/couchpotato.pid}
|
||||||
|
|
||||||
|
# Other startup args
|
||||||
|
CP_DAEMON_OPTS=" CouchPotato.py --daemon --pid_file=${CP_PID_FILE}"
|
||||||
|
|
||||||
|
test -x $CP_DAEMON || exit 0
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
echo "Starting $DESC"
|
echo "Starting $DESC"
|
||||||
rm -rf $PID_FILE || return 1
|
rm -rf $CP_PID_FILE || return 1
|
||||||
touch $PID_FILE
|
touch $CP_PID_FILE
|
||||||
chown $RUN_AS $PID_FILE
|
chown $CP_RUN_AS $CP_PID_FILE
|
||||||
start-stop-daemon -d $APP_PATH -c $RUN_AS --start --background --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS
|
start-stop-daemon -d $CP_APP_PATH -c $CP_RUN_AS --start --background --pidfile $CP_PID_FILE --exec $CP_DAEMON -- $CP_DAEMON_OPTS
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
echo "Stopping $DESC"
|
echo "Stopping $DESC"
|
||||||
start-stop-daemon --stop --pidfile $PID_FILE --retry 15
|
start-stop-daemon --stop --pidfile $CP_PID_FILE --retry 15
|
||||||
;;
|
;;
|
||||||
|
|
||||||
restart|force-reload)
|
restart|force-reload)
|
||||||
echo "Restarting $DESC"
|
echo "Restarting $DESC"
|
||||||
start-stop-daemon --stop --pidfile $PID_FILE --retry 15
|
start-stop-daemon --stop --pidfile $CP_PID_FILE --retry 15
|
||||||
start-stop-daemon -d $APP_PATH -c $RUN_AS --start --background --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS
|
start-stop-daemon -d $CP_APP_PATH -c $CP_RUN_AS --start --background --pidfile $CP_PID_FILE --exec $CP_DAEMON -- $CP_DAEMON_OPTS
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
N=/etc/init.d/$NAME
|
N=/etc/init.d/$NAME
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# COPY THIS FILE TO /etc/default/couchpotato
|
||||||
|
# OPTIONS: APP_PATH, RUN_AS, DAEMON_PATH, CP_PID_FILE
|
||||||
|
|
||||||
|
APP_PATH=
|
||||||
|
RUN_AS=root
|
||||||
Reference in new issue
Block a user