Fedora 10 Startup script.

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
Dipstick
Newbie
Newbie
Posts: 4
Joined: September 22nd, 2008, 5:23 pm

Fedora 10 Startup script.

Post by Dipstick »

Hello,

First off I just want to say a big thank you to the devs - This is a really great program!

After using SABnzbd on Ubuntu for so long, I decided to give fedora (10)  a go . I got it up and running without too much trouble. The only problem was the start up script in the wiki didnt work when booting , - it worked fine when doing a /etc/init.d/Sabnzbd start ? so I decided to make a new one which uses the fedora functions.

*****Sabnzbd is running as root using this script ! -I couldn't get it to  use sudo as it needs a tty (Is sudo is setup correctly in fedora)*****

Hopefully this will be of use to someone - If anyone is interested here it is......

Code: Select all

#!/bin/bash
#
# SABnzbd is a free/open-source cross-platform binary newsreader written in Python.
#
#
# chkconfig:   345 99 05
#
#
### BEGIN INIT INFO
# Provides: $SABnzbd
# Required-Start: $local_fs $syslog $network
# Required-Stop: $local_fs $syslog
# Default-Start:  2345
# Default-Stop: 99
# Short-Description:  binary newsreader written in Python
# Description: SABnzbd1 is a program to download binary files from \
#              Usenet servers. Many people upload all sorts of interesting \
#	       material to Usenet and you need a special program to get \
#	       this material with the least effort.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

prog=SABnzbd
pidfile=${PIDFILE-/var/run/sabnzbd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/sabnzbd}
RETVAL=0


start() {
        echo -n $"Starting $prog: "
        daemon --pidfile=${pidfile} `/usr/share/SABnzbd-0.4.6/SABnzbd.py -d -f /usr/share/SABnzbd-0.4.6/sabnzbd.ini`
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch ${lockfile} 
        return $RETVAL
}

stop() {
	echo -n $"Stopping $prog: "
	# Uncomment below and change appropriate details if USING a user and password.
        #action `/usr/bin/wget -q --delete-after "http://HOSTADDRESS:PORT/sabnzbd/api?mode=shutdown&ma_username=USERNAME&ma_password=PASSWORD"`
        # Uncomment and change appropriate details if NOT using a user password
        #action `/usr/bin/wget -q --delete-after "http://HOSTADDRESS:PORT/sabnzbd/api?mode=shutdown"`
	RETVAL=$?
	echo
	[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}


# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
        status $prog
	RETVAL=$?
	;;
  *)
	echo $"Usage: $prog {start|stop|status}"
	RETVAL=3
esac

exit $RETVAL
Save the file as  "SABnzbd"  into /etc/rc.d/init.d/ then, as root do a

Code: Select all

chkconfig --add SABnzbd
You may also need to change the path to the ini file - I moved it from the home directory!

Post back and let me know if this work for you or if you have any suggestions!

Cheers dipstick
Last edited by Dipstick on February 16th, 2009, 5:33 pm, edited 1 time in total.
everzwijn
Newbie
Newbie
Posts: 1
Joined: June 14th, 2009, 9:54 am

Re: Fedora 10 Startup script.

Post by everzwijn »

I think you forgot to add the instruction to make the script file executable...

Apart from that it 's a good script!
Post Reply