#!/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" start-stop-daemon --start --quiet --user "${SAB_USER}" --pidfile "${SAB_PID}" -d "${SAB_PATH}" --exec python "${SAB_PY}" -- -d -f "${SAB_CFG}" # SABnzbd 0.6.0 forks after launch, so we wait 5 seconds to search for its new PID sleep 5 ps -e a | grep [S]ABnzbd.py | awk '{ print $1 }' > "${SAB_PID}" eend $? } stop() { ebegin "Stopping SABnzbd" start-stop-daemon --stop --retry 30 --pidfile "${SAB_PID}" eend $? }