Clarkconnect 4.2 ~ SABnzbd Daemon

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
sedaai
Newbie
Newbie
Posts: 2
Joined: July 26th, 2008, 7:15 pm

Clarkconnect 4.2 ~ SABnzbd Daemon

Post by sedaai »

Hi all,

I have installed SABnzbd following the directions exactly at http://sabnzbd.wikidot.com/install-cc42 (Only modification I made was to move the SABnzbd folder to /usr/local/src/

Now I am trying to run SABnzbd as a daemon so I don't need to have a terminal running all the time, I have tried following the instructions Unix Daemon instructions however I am receiving an error, I was hoping someone could have a look and tell me where im going wrong;

# /etc/init.d/SABnzbd #

#! /bin/sh

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

exit 0

This is the error when I try running /etc/init.d/SABnzbD

[root@gateway ~]# /etc/init.d/SABnzbD start
Starting SABnzbd.
/usr/bin/sudo: unable to exec /usr/local/src/SABnzbd/SABnzbd.py: No such file or directory
/root/.sabnzbd/sabnzbd.ini: line 1: __version__: command not found
/root/.sabnzbd/sabnzbd.ini: line 2: [misc]: command not found
/root/.sabnzbd/sabnzbd.ini: line 3: log_dir: command not found
/root/.sabnzbd/sabnzbd.ini: line 4: auto_browser: command not found
/root/.sabnzbd/sabnzbd.ini: line 5: permissions: command not found
/root/.sabnzbd/sabnzbd.ini: line 6: check_new_rel: command not found
/root/.sabnzbd/sabnzbd.ini: line 7: replace_spaces: command not found
/root/.sabnzbd/sabnzbd.ini: line 8: fail_on_crc: command not found
/root/.sabnzbd/sabnzbd.ini: line 9: enable_filejoin: command not found
/root/.sabnzbd/sabnzbd.ini: line 10: enable_unzip: command not found
/root/.sabnzbd/sabnzbd.ini: line 11: enable_unrar: command not found
/root/.sabnzbd/sabnzbd.ini: line 12: enable_par_cleanup: command not found
/root/.sabnzbd/sabnzbd.ini: line 13: par_option: command not found
/root/.sabnzbd/sabnzbd.ini: line 14: config_lock: command not found
/root/.sabnzbd/sabnzbd.ini: line 15: safe_postproc: command not found
/root/.sabnzbd/sabnzbd.ini: line 16: pause_on_post_processing: command not found
/root/.sabnzbd/sabnzbd.ini: line 17: cleanup_list: command not found
/root/.sabnzbd/sabnzbd.ini: line 18: ignore_samples: command not found
/root/.sabnzbd/sabnzbd.ini: line 19: send_group: command not found
/root/.sabnzbd/sabnzbd.ini: line 20: download_dir: command not found
/root/.sabnzbd/sabnzbd.ini: line 21: download_free: command not found
/root/.sabnzbd/sabnzbd.ini: line 22: complete_dir: command not found
/root/.sabnzbd/sabnzbd.ini: line 23: script_dir: command not found
/root/.sabnzbd/sabnzbd.ini: line 24: nzb_backup_dir: command not found
/root/.sabnzbd/sabnzbd.ini: line 25: cache_dir: command not found
/root/.sabnzbd/sabnzbd.ini: line 26: dirscan_dir: command not found
/root/.sabnzbd/sabnzbd.ini: line 27: dirscan_speed: command not found
/root/.sabnzbd/sabnzbd.ini: line 28: refresh_rate: command not found
/root/.sabnzbd/sabnzbd.ini: line 29: rss_rate: command not found
/root/.sabnzbd/sabnzbd.ini: line 30: bandwith_limit: command not found
/root/.sabnzbd/sabnzbd.ini: line 31: cache_limit: command not found
/root/.sabnzbd/sabnzbd.ini: line 32: email_server: command not found
/root/.sabnzbd/sabnzbd.ini: line 33: email_to: command not found
/root/.sabnzbd/sabnzbd.ini: line 34: email_from: command not found
/root/.sabnzbd/sabnzbd.ini: line 35: email_account: command not found
/root/.sabnzbd/sabnzbd.ini: line 36: email_pwd: command not found
/root/.sabnzbd/sabnzbd.ini: line 37: email_endjob: command not found
/root/.sabnzbd/sabnzbd.ini: line 38: email_full: command not found
/root/.sabnzbd/sabnzbd.ini: line 39: schedlines: command not found
/root/.sabnzbd/sabnzbd.ini: line 40: dirscan_opts: command not found
/root/.sabnzbd/sabnzbd.ini: line 41: dirscan_script: command not found
/root/.sabnzbd/sabnzbd.ini: line 42: top_only: command not found
/root/.sabnzbd/sabnzbd.ini: line 43: auto_sort: command not found
/root/.sabnzbd/sabnzbd.ini: line 44: enable_tv_sorting: command not found
/root/.sabnzbd/sabnzbd.ini: line 45: tv_sort_string: command not found
/root/.sabnzbd/sabnzbd.ini: line 46: web_color: command not found
/root/.sabnzbd/sabnzbd.ini: line 47: web_color2: command not found
Using domain server:
Name: 0.0.0.0
Address: 0.0.0.0#53
Aliases:

Host = not found: 3(NXDOMAIN)
/root/.sabnzbd/sabnzbd.ini: line 49: port: command not found
/root/.sabnzbd/sabnzbd.ini: line 50: web_dir: command not found
/root/.sabnzbd/sabnzbd.ini: line 51: web_dir2: command not found
/root/.sabnzbd/sabnzbd.ini: line 52: username: command not found
/root/.sabnzbd/sabnzbd.ini: line 53: password: command not found
/root/.sabnzbd/sabnzbd.ini: line 54: [logging]: command not found
/root/.sabnzbd/sabnzbd.ini: line 55: enable_cherrypy_logging: command not found
/root/.sabnzbd/sabnzbd.ini: line 56: log_level: command not found
/root/.sabnzbd/sabnzbd.ini: line 57: max_log_size: command not found
/root/.sabnzbd/sabnzbd.ini: line 58: log_backups: command not found
/root/.sabnzbd/sabnzbd.ini: line 59: [newzbin]: command not found
/root/.sabnzbd/sabnzbd.ini: line 60: username: command not found
/root/.sabnzbd/sabnzbd.ini: line 61: password: command not found
/root/.sabnzbd/sabnzbd.ini: line 62: bookmarks: command not found
/root/.sabnzbd/sabnzbd.ini: line 63: unbookmark: command not found
/root/.sabnzbd/sabnzbd.ini: line 64: bookmark_rate: command not found
/root/.sabnzbd/sabnzbd.ini: line 65: [servers]: command not found
/root/.sabnzbd/sabnzbd.ini: line 66: [[news.astraweb.com:119]]: command not found

The files are definately located in those folders, any help would be much appreciated.
User avatar
mantis006
Release Testers
Release Testers
Posts: 17
Joined: January 28th, 2008, 5:06 am
Contact:

Re: Clarkconnect 4.2 ~ SABnzbd Daemon

Post by mantis006 »

for security reasons, I would *highly* recommend not using root for daemon processes.  If there were ever a way to execute arbitrary code or permissions were not set restrictvely enough on the code the daemon runs, it would be executed with root privileges.

For a lot of gnu systems, we use a utility called start-stop-daemon.  Particularly on gentoo linux like I run, we use a combination of init.d/conf.d scripts for configuring and controller daemons.  this is why my init.d looks like (variables not declared here are declared in the corresponding conf.d script, that's just how runscript rolls):

Code: Select all

#!/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+"
    if ! check_config ; then
        eend 1
        return 1
    fi

    start-stop-daemon --quiet --start -c ${SAB_USER}:${SAB_GROUP} \
        --exec /var/lib/SABnzbd+/sabnzbd/SABnzbd.py -- -s ${SAB_HOSTNAME}:${SAB_PORT} -d &> /dev/null
    eend $?
}

stop() {
    ebegin "Stopping SABnzbd+"
    curl -s http://${SAB_HOSTNAME}:${SAB_PORT}/sabnzbd/shutdown > /dev/null
    eend $?
}

check_config() {
    if [ ! -e ${SAB_CONFIGFILE} ] ; then
        eerror "ERROR: can't find ${SAB_CONFIGFILE}."
        return 1
    else
        return 0
    fi
}
as you can see, start-stop-daemon is a super great way of starting and stoping daemons.  If you don't have that available, you might want to give something like this a try if sudo isn't working quite right:

Code: Select all

su ${SABUSER} -c "${SABCOMMANDS}"
I think something's getting screwed up with your -f argument and sudo is executing your config file as a script, the fact that it's going through trying to RUN your config settings.  The fix could be as easy as wrapping your whole sudo command in quotes "".  Try that and post back if you still need help on this.

Wasn't daemonized sabnzbd easier with setup.py and /etc/sabnzbd.conf?  *sigh*
~Chris
kbunny
Newbie
Newbie
Posts: 9
Joined: August 5th, 2008, 3:32 pm

Re: SABnzbd Daemon on Wiki

Post by kbunny »

I saw that a general (?) unix daemon start/stop script has been added to the wiki under install as a unix daemon, which is helpful.

However, the Gentoo version by mantis006 seems rather useful as well - perhaps this could also be added to the wiki?

Additionally, my BusyBox enabled Synology107+ NAS did not respond well to the sudo command used in the wiki-article: I had to change this to:

Code: Select all

su -l $User -c "/volume1/opt/share/SABnzbd/SABnzbd.py -d -f /volume1/opt/share/SABnzbd/SABnzbd.ini" 
where User has been set to guest (and not root, ever). Obviously, the path is specific to my installation.

Maybe this could warrant a reopening of Ticket #15 ?
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: SABnzbd Daemon on Wiki

Post by shypike »

kbunny wrote: Maybe this could warrant a reopening of Ticket #15 ?
It isn't closed...

The section is applicable for full operating systems like Ubuntu, RedHat, Suse etc.
Not particularly to embedded derivatives like NAS, which tend to have
older and/or stripped OS'es (for good reasons).

We do not support NAS solutions, since we do not have the resources to so,
especially given the sheer number of them and the idiosyncrasies of each.
However, some NAS support forums do an good job.
So maybe we should add pointers to those boards instead.
Post Reply