I have been using a basic shell script to start SAB on my gentoo box, and am trying to change that to use the start-stop-daemon as I am wanting to use some PID tracking for monit.
Code: Select all
#!/sbin/runscript
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
opts="start stop"
depend() {
need net
}
start() {
ebegin "Starting SABnzbd+"
if ! check_config ; then
eend 1
return 1
fi
start-stop-daemon --quiet --start -c ${SAB_USER}:${SAB_GROUP} \
--exec /SABAlpha/SABnzbd.py -- -d -f ${INIFILE} &> /dev/null
eend $?
}
stop() {
ebegin "Stopping SABnzbd+"
/usr/bin/wget -q --delete-after "http://${SAB_HOST}:${SAB_PORT}/sabnzbd/api?mode=shutdown"
eend $?
}
check_config() {
if [ ! -e ${SAB_CONFIGFILE} ] ; then
eerror "ERROR: can't find ${SAB_CONFIGFILE}."
return 1
else
return 0
fi
}
I cannot however get sab to start. I always get a [!!] in the start up, but can't find any way of getting more information as to why it is failing.
My normal runscript, has been running as root (yes i know not a good idea) and I am wanting to change that too.
I have created a new user and group called sabnzbd, but I dont actually know how to get this part operational (hence why i was using root )
The really strange part of all this, is that sometimes SAB is running from a ps -ax, but if i do a /etc/init.d/sab stop, it says sab isnt running.