Page 1 of 1

Run as service (on linux).

Posted: January 23rd, 2009, 4:45 am
by E71
Hi.

Not sure what the rules are and whether we can list multiple ideas in a single post so feel free to delete if I'm breaking the rules (and apologies in advance).

- Run SABnzbd as service on linux (most important to me). I've tried adding '&' but no luck. I need to be able to chkconfig it.
- Option to insert RSS fetched NZBs into the top of the queue instead of the bottom.
- Option to manually add new NZBs into the top of the queue.
- Option to pause right after completion of a specific queue item.

Thanks guys, SABnzbd rocks!

E71

Re: Run as service (on linux).

Posted: January 23rd, 2009, 6:17 am
by shypike
There are several solutions for Unix service in this forum.
Including one in the Wiki: http://sabnzbd.wikidot.com/install-as-a-unix-daemon

Release 0.5.0 will have job priorities, accomplishing your RSS requests.

The last thing can be accomplished by a user-defined script.
It would contain something like:

Code: Select all

wget http://HOST:PORT/sabnzbd/pause
If you select that script for a specific job, SABnzbd will pause after completion.
(Although with some delay, because downloading of the next job will have started before
post-processing on the previous one is finished).

Re: Run as service (on linux).

Posted: January 23rd, 2009, 10:43 am
by inpheaux
Note that the version in the unofficial Ubuntu repository includes a script to run as a service in /etc/default/sabnzbdplus. Just edit that script to set it up and it will automatically run at boot.

Also, for the automatically-pause script, you'll probably want to also use the --delete-after flag so you don't end up with a bunch of files called "pause".

Re: Run as service (on linux).

Posted: January 23rd, 2009, 10:29 pm
by E71
Thanks for the help guys.

I got the pause script working however I'm having an issue with the init.d script.

The init.d script works but SABnzbd now produces the following errors:
- 'WARNING unrar binary... NOT found'
- 'feedparser module missing'

Consequently the next item being downloaded failed to unpack (files were moved to .../completed/category/_FAILED_downloadname with error message 'WARNING [newsunpack] Missing expected file: Filename.ext => unrar error?')

^ I'd like to note that I did check via the sfv if all the rar files were ok and they appear to be.

E71

Re: Run as service (on linux).

Posted: January 24th, 2009, 12:51 pm
by shypike
Init.d scripts have a less complete $PATH variable than a user session gets.
Just extend the PATH variable in your script to include where unrar lives.

Re: Run as service (on linux).

Posted: January 26th, 2009, 11:48 am
by E71
I extended the path in the init.d script to include the unrar binary but I still receive the 'unrar binary not found' error.

My /etc/init.d/sabnzbd

Code: Select all

#!/bin/sh

PATH=$PATH:/usr/local/bin
export PATH

case "$1" in
start)
  echo "Starting sabnzbd service."
  /usr/bin/sudo -u usenet -H /progs/sabnzbd/SABnzbd.py -d -f /home/usenet/.sabnzbd/sabnzbd.ini
;;
stop)
  echo "Stopping sabnzbd service."
  /usr/bin/wget -q --delete-after "http://localhost:6789/sabnzbd/api?mode=shutdown&ma_username=user&ma_password=pass"
;;
*)
  echo "Usage: $0 {start|stop}"
  exit 1
esac

exit 0
I'm guessing I've done it wrong above?

Is the 'feedparser module missing' error also caused by the PATH problem?

Re: Run as service (on linux).

Posted: January 26th, 2009, 3:01 pm
by shypike
There must still be something wrong with the path.
Therefore I suggest that you replace "/progs/sabznbd/SABnzbd.py etc."
temporary with some script that tests the presence of unrar.

The code, handling the unrar detection inside SABnzbd is quite simple,
it just checks all PATH locations from left to right for presence of unrar.

Just to make sure: put /usr/local/bin before the PATH instead of behind it.

If the feedparser is reported missing it has not been properly installed as a Python module.
Simple test from the command line:

Code: Select all

python
   import feedparser
This should not give an error.

Re: Run as service (on linux).

Posted: January 28th, 2009, 1:00 am
by E71
I replaced SABnzbd.py with a script to adjust path and load SABnzbd.py -- Appears to be working fine now.. feedparser too.

Thanks for your help. :)

E71