Page 1 of 1

Fedora 10 Startup script.

Posted: February 8th, 2009, 5:31 am
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

Re: Fedora 10 Startup script.

Posted: June 14th, 2009, 9:56 am
by everzwijn
I think you forgot to add the instruction to make the script file executable...

Apart from that it 's a good script!