Kodi Community Forum

Full Version: How to AutoStart SABNzb+ (Or any application)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey All,

New to the forums, new to linux in general.

I have had my Xbmc Live machine up for a few weeks and all is well, just trying to streamline adding media to it.

Somehow I successfully got SABNzb+ installed and am able to run it when i SSH into my xbmc machine from OS X. But this isn't the optimal solution as when I terminate my SSH session, it closes SABNzb.

So my question is how do I set it up so that the program will launch automatically during startup and all I have to do is drop .Nzbs in my watch folder?

Thanks for any help, greatly appreciated.

Either create a proper startup script and place it in /etc/init.d or the quick and easy way is to add the command you run to the file /etc/rc.local and it will be started at boot time.
This is the one I use that came with the install...may have to adjust the location of the files if you installed it in a different location:


# Copyright (C) 2008-2009 by JCF Ploemen <[email protected]>
# released under GPL, version 2 or later

# Provides:          sabnzbdplus
# Required-Start:    $local_fs $network $remote_fs
# Required-Stop:     $local_fs $network $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: SABnzbd+ binary newsgrabber


[ -x $DAEMON ] || exit 0

NAME=$(basename $DAEMON)
DESC="SABnzbd+ binary newsgrabber"
PYTHONEXEC="$(readlink -f $(sed -n '1s/^#\!\([a-z0-9\.\/]\+\).*/\1/p' $DAEMON))"

. /lib/lsb/init-functions

check_retval() {
        if [ $? -eq 0 ]; then
                log_end_msg 0
                return 0
                log_end_msg 1
                exit 1

is_running() {
        # returns 0 when running, 1 otherwise
        start-stop-daemon --quiet --stop --test --user $USER --exec $PYTHONEXEC --name $NAME || return 1

load_settings() {
        [ -r $SETTINGS ] || exit 0
        . $SETTINGS

        [ -z "$USER" ] && {
                log_warning_msg "$DESC: not configured, aborting. See $SETTINGS";
                exit 0; }

        [ -n "$CONFIG" ] && OPTIONS="$OPTIONS --config-file $CONFIG"
        [ -n "$HOST" -a -n "$PORT" ] && OPTIONS="$OPTIONS --server $HOST:$PORT"

case "$1" in
                if ! is_running; then
                        log_daemon_msg "Starting $DESC"
                        start-stop-daemon --quiet --chuid $USER --start --exec $DAEMON -- $OPTIONS
                        # create a pidfile; we don't use it but some monitoring app likes to have one
                        [ -w $(dirname $PIDFILE) ] && \
                                pgrep -f -x -n -u $USER "$(sed -n '1s/^#\!//p' $DAEMON) $DAEMON $OPTIONS" > $PIDFILE
                        log_success_msg "$DESC: already running"
                if is_running; then
                        log_daemon_msg "Stopping $DESC"
                        start-stop-daemon --quiet --stop --signal 15 --retry 30 --exec $PYTHONEXEC --name $NAME --user $USER
                        log_success_msg "$DESC: not running"
                [ -f $PIDFILE ] && rm -f $PIDFILE
                $0 stop
                $0 start
                log_failure_msg "Usage: $0 {start|stop|restart|force-reload}"

exit 0

I made a link in /etc/rc2.d/ (and other runlevels) pointing to that script (update-rc.d sabnzbdplus start 20)
Thanks for the help.

I used the script you posted and just made that the /etc/init.d/sabnzbdplus file.... But I am not quite sure how to do what you posted after the script... making a link? Forgive me as I am new to all this.

Also tried doing the rc.local file, but that didn't work.

hate to be a nuisance, but would greatly appreciate some more help.
run this command:

update-rc.d sabnzbdplus start 20

it will create auto-start links to the sabnzbdplus script you created, with priority 20...you can change that priority if you want. that checks all the scripts in init.d and makes them auto start on all runlevels by putting a sym link in /etc/rc#.d/ (you can assign specific runlevels, 2 is the one you boot into...but I just make it for all).