slackbuilds/network/sabnzbd/rc.sabnzbd

23 lines
492 B
Bash

#!/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