--- sabnzbd.initd 2013-01-07 07:01:25.000000000 +1100 +++ /etc/init.d/sabnzbd 2013-02-18 07:30:23.497311495 +1100 @@ -3,17 +3,25 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/net-nntp/sabnzbd/files/sabnzbd.initd,v 1.2 2013/01/06 19:44:49 jsbronder Exp $ +rundir=/var/run/sabnzbd +# pid file name is hard-coded in sabnzbd, this must match +pidfile=$rundir/sabnzbd-${SABNZBD_PORT}.pid depend() { need net } +start_pre() { + checkpath -q -d -o ${SABNZBD_USER}:${SABNZBD_GROUP} -m 0770 "${rundir}" +} + start() { ebegin "Starting SABnzbd" start-stop-daemon \ --quiet \ --start \ + --pidfile ${pidfile} \ --user ${SABNZBD_USER} \ --group ${SABNZBD_GROUP} \ --name sabnzbd \ @@ -22,6 +30,7 @@ --server ${SABNZBD_SERVER}:${SABNZBD_PORT} \ --config-file ${SABNZBD_CONFIGFILE} \ --logging ${SABNZBD_LOGGING} \ + --pid ${rundir}/ \ --daemon eend $? }