need init.d daemon startup method help

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
tret
Full Member
Full Member
Posts: 148
Joined: August 2nd, 2008, 2:07 pm

need init.d daemon startup method help

Post 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
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: need init.d daemon startup method help

Post by switch »

Change
http://HOSTADDRESS:PORT/sabnzbd/api?mode=shutdown
to
http://HOSTADDRESS:PORT/sabnzbd/api?mode=shutdown&ma_username=USER&ma_password=PASS
tret
Full Member
Full Member
Posts: 148
Joined: August 2nd, 2008, 2:07 pm

Re: need init.d daemon startup method help

Post 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
User avatar
sander
Release Testers
Release Testers
Posts: 8830
Joined: January 22nd, 2008, 2:22 pm

Re: need init.d daemon startup method help

Post 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:~$
Please don't send me unrequested PM's; the forum is the best way to communicate.
If someone helps you, please reply to that help.
f you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
tret
Full Member
Full Member
Posts: 148
Joined: August 2nd, 2008, 2:07 pm

Re: need init.d daemon startup method help

Post 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
tastynzb
Release Testers
Release Testers
Posts: 5
Joined: September 26th, 2009, 3:01 pm

Re: need init.d daemon startup method help

Post 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:~$
Last edited by tastynzb on September 29th, 2009, 11:13 pm, edited 1 time in total.
Post Reply