Page 1 of 1

need init.d daemon startup method help

Posted: August 2nd, 2008, 2:13 pm
by tret
Hey everyone, I have sabnzbd+ 0.4.2 running on ubuntu hardy. 1st of all it works perfectly, all features work great and I have configured it to use the init.d daemon start/stop method described in the sabnzbd+ manual page. This allows it to start on bootup and it works fine with one exception. If i enable sabnzbd+ authentication the stop portion of the code no longer works properly and sabnzbd+ fails to shut down properly on system reboot/shutdown or with a manual sh stop execution. Is there something that can be done with the code to authenticate the wget line to allow me to use the daemon stop and still use sabnzbd+ authentication? Thanks in advance. Here is the code I am using at /etc/init.d/sabnzb.sh

Rob

Code: Select all

#! /bin/sh

case "$1" in
start)
  echo "Starting SABnzbd."
  /usr/bin/sudo -u sabuser -H /usr/local/src/SABnzbd/SABnzbd.py -d -f /home/sabuser/.sabnzbd/sabnzbd.ini
;;
stop)
  echo "Shutting down SABnzbd."
  /usr/bin/wget -q --delete-after "http://HOSTADDRESS:PORT/sabnzbd/api?mode=shutdown"
;;
*)
  echo "Usage: $0 {start|stop}"
  exit 1
esac

exit 0

Re: need init.d daemon startup method help

Posted: August 2nd, 2008, 2:33 pm
by switch
Change
http://HOSTADDRESS:PORT/sabnzbd/api?mode=shutdown
to
http://HOSTADDRESS:PORT/sabnzbd/api?mode=shutdown&ma_username=USER&ma_password=PASS

Re: need init.d daemon startup method help

Posted: August 2nd, 2008, 3:13 pm
by tret
switch wrote: Change
http://HOSTADDRESS:PORT/sabnzbd/api?mode=shutdown
to
http://HOSTADDRESS:PORT/sabnzbd/api?mode=shutdown&ma_username=USER&ma_password=PASS
This works great, thanks again Switch. Also i thought I would share that in order to have this script stop sabnzbd properly on reboot and shutdown a symbolic link needs to be made to it in both the /etc/rc0.d/ and /etc/rc6.d/ directories using something similar to "K99sabnzb" as the link name.

Thanks again for your help

Re: need init.d daemon startup method help

Posted: August 2nd, 2008, 3:36 pm
by sander
Cool. It works for me. I used the information from http://sabnzbd.wikidot.com/install-as-a-unix-daemon and http://www.xs4all.nl/~mgj1/sabnzbd.htm

Some quotes from my history:

Code: Select all

sudo gedit /etc/init.d/sabnzbd

sudo chmod +x /etc/init.d/sabnzbd
sudo update-rc.d -f sabnzbd remove
sudo update-rc.d -f sabnzbd defaults


sander@ubuntu804:~$ /etc/init.d/sabnzbd start
Starting SABnzbd.

sander@ubuntu804:~$ /etc/init.d/sabnzbd stop
Shutting down SABnzbd.

sander@ubuntu804:~$

Re: need init.d daemon startup method help

Posted: August 2nd, 2008, 3:54 pm
by tret
sander wrote: Cool. It works for me. I used the information from http://sabnzbd.wikidot.com/install-as-a-unix-daemon and http://www.xs4all.nl/~mgj1/sabnzbd.htm

Some quotes from my history:

Code: Select all

sudo gedit /etc/init.d/sabnzbd

sudo chmod +x /etc/init.d/sabnzbd
sudo update-rc.d -f sabnzbd remove
sudo update-rc.d -f sabnzbd defaults


sander@ubuntu804:~$ /etc/init.d/sabnzbd start
Starting SABnzbd.

sander@ubuntu804:~$ /etc/init.d/sabnzbd stop
Shutting down SABnzbd.

sander@ubuntu804:~$
I like this method much better than manually creating the links. Thanks for the new info. Appreciate your posting it here.

Rob

Re: need init.d daemon startup method help

Posted: September 29th, 2009, 10:45 pm
by tastynzb
I did exactly this, but the daemon still doesn't start automaticly on boot. I have to start it manually $ /etc/init.d/sabnzbd start

edit:
Fixed by starting daemon later:
sudo update-rc.d -f sabnzbd defaults 99
This issue is explained here:
http://forums.sabnzbd.org/index.php?topic=2537.0
sander wrote: Cool. It works for me. I used the information from http://sabnzbd.wikidot.com/install-as-a-unix-daemon and http://www.xs4all.nl/~mgj1/sabnzbd.htm

Some quotes from my history:

Code: Select all

sudo gedit /etc/init.d/sabnzbd

sudo chmod +x /etc/init.d/sabnzbd
sudo update-rc.d -f sabnzbd remove
sudo update-rc.d -f sabnzbd defaults


sander@ubuntu804:~$ /etc/init.d/sabnzbd start
Starting SABnzbd.

sander@ubuntu804:~$ /etc/init.d/sabnzbd stop
Shutting down SABnzbd.

sander@ubuntu804:~$