Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh -
- ### BEGIN INIT INFO
- # Provides: Radarr
- # Required-Start: $local_fs $network $remote_fs
- # Required-Stop: $local_fs $network $remote_fs
- # Should-Start: $NetworkManager
- # Should-Stop: $NetworkManager
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: starts instance of Radarr
- # Description: starts instance of Radarr using start-stop-daemon
- ### END INIT INFO
- ############### EDIT ME ##################
- # path to app
- APP_PATH=/home/mint/Radarr
- # user
- RUN_AS=radarr
- # path to mono bin
- DAEMON=/usr/bin/mono
- # options for mono
- DAEMON_OPTS=""
- # Path to store PID file
- PID_PATH=/var/run/radarr
- ############### END EDIT ME ##################
- mkdir -p ${PID_PATH}
- PID_FILE=${PID_PATH}/radarr.pid
- EXENAME=`basename ${APP_PATH}/Radarr.exe`
- DESC=`basename ${APP_PATH}/Radarr.exe .exe`
- RADARR_PID=`ps auxf | grep $EXENAME | grep -v grep | awk '{print $2}'`
- test -x $DAEMON || { echo "$DAEMON must be executable."; exit 1; }
- set -e
- echo $RADARR_PID > $PID_FILE
- case "$1" in
- start)
- if [ -z "${RADARR_PID}" ]; then
- echo "Starting $DESC"
- rm ${PID_FILE} || return 1
- install -d --mode=0755 -o $RUN_AS $PID_PATH || return 1
- start-stop-daemon -d $APP_PATH -c $RUN_AS --start --background --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS $EXENAME
- else
- echo "${DESC} already running."
- fi
- ;;
- stop)
- echo "Stopping $DESC"
- echo $RADARR_PID > $PID_FILE
- start-stop-daemon --stop --pidfile $PID_FILE --retry 15
- ;;
- restart|force-reload)
- echo "Restarting $DESC"
- start-stop-daemon --stop --pidfile $PID_FILE --retry 15
- start-stop-daemon -d $APP_PATH -c $RUN_AS --start --background --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS $EXENAME
- ;;
- *)
- echo "Usage: `basename $0` {start|stop|restart|force-reload}" >&2
- exit 1
- ;;
- esac
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement