aboutsummaryrefslogtreecommitdiff
path: root/network/sabnzbd/rc.sabnzbd
blob: a2a7c7e69e6dc85f36cceda55512a085bcdc12a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

SABNZBD_USER="sabnzbd"
SABNZBD_CONF="/etc/sabnzbd/sabnzbd.ini"

PIDFILE="/var/run/sabnzbd/sabnzbd-8080.pid"

case "$1" in
	start)
		if [[ -f $PIDFILE ]]; then
			echo "Pidfile $PIDFILE already exists, is sabnzbd already running ?"
			exit 1
		fi
		su - $SABNZBD_USER -c "unset DISPLAY; python -OO /opt/sabnzbd/SABnzbd.py -f $SABNZBD_CONF -d --pid /var/run/sabnzbd" -s /bin/sh
    		;;
  	stop)
		kill $(cat $PIDFILE)
    		;;
  	*)
    	echo "usage: $0 {start|stop}"
esac
exit 0