Page 1 of 1

Debian init script

Posted: March 20th, 2010, 3:23 pm
by Bam
I got this all running on my debian box today. Maybe this isn't the place to share this?

Code: Select all

#!/bin/bash

case "$1" in
start)
  echo "Starting SABnzbd."
  /usr/bin/sudo -u sabnzb -H /usr/share/sabnzbd/SABnzbd.py -d -f /home/sabnzb/.sabnzbd/sabnzbd.ini
;;
stop)
  echo "Shutting down SABnzbd."
  /usr/bin/wget -q --delete-after "http://localhost:8080/sabnzbd/api?mode=shutdown&apikey=APIKEYHERE"
;;
*)
  echo "Usage: $0 {start|stop}"
  exit 1
esac

exit 0
save above as sabnzbd

init script goes in /etc/init.d

chmod +x

you need to create user sabnzb

also must untar src file to /usr/share/sabnzbd


good luck

Re: Debian init script

Posted: March 21st, 2010, 6:03 am
by jcfp
For a manual install this would work, although you'd probably still have to link it into the various /etc/rcX.d/... either by hand or using update-rc.d. For anything newer than lenny, the program is available as a package which includes an init script already.

Re: Debian init script

Posted: December 19th, 2011, 8:03 am
by danfozzy
Sorry for bumping an old script, but I'm having a problem with autostarting this script.

It runs the script at startup, but just as it runs up I'm getting a signal 15 error and it shuts down again

I've seen a little script that may help but I don't know how to include it in the above script!

start-stop-daemon --quiet --stop --signal 15 --retry 30 --exec $PYTHONEXEC --name $NAME --user $USER

Will this line help me??