Can't get startup script to work

Hi all :slight_smile:

I’m having some problems getting my sabnzbd script to run on startup.

I’m sure it’s some small thing I’ve forgotten, but for the life of me I can’t find out why it’s not working :stuck_out_tongue:


/etc/inid.t
-rwxr-xr-x   1 root root   394 2009-12-04 12:50 sabdaemon

Symbolic links in /etc/init.d/rc5.d


lrwxrwxrwx  1 root root   21 2009-12-04 13:03 K99sabdaemon -> /etc/init.d/sabdaemon

lrwxrwxrwx  1 root root   21 2009-12-04 13:03 S99sabdaemon -> /etc/init.d/sabdaemon

The script itself, note that it does run when I start it with ./sabdaemon start


#! /bin/sh

case "$1" in
start)
  echo "Starting SABnzbd."
  /usr/bin/sudo -u xenth -H "/home/xenth/apps/linux/sabnzbd/sabnzbd-0.4.12/SABnzbd.py" -d -f /home/xenth/.
sabnzbd/sabnzbd.ini
;;
stop)
  echo "Shutting down SABnzbd."
  /usr/bin/wget -q --delete-after "http://localhost:8080/sabnzbd/api?mode=shutdown&apikey=ENTERAPIKEYHERE"
;;
*)
  echo "Usage: $0 {start|stop}"
  exit 1
esac

exit 0

Thanks in advance :slight_smile:

The best way to do this in openSUSE is:

  1. Use the script /etc/init.d/skeleton as a starting point for making your own script.
  2. Look at the comment lines (with a #) at the beginning of the skeleton. These comment lines are interpreted bij YaST and contain information about the runlevels where is has to start. Adapt when needed
  3. Go to YaST > System > System Services (runlevel). You will now see your script in the list ands it can be started from there. YaST will then make the apropriate links.

Better first undo all the links you made earlier, to not frustrate YaST.

Very nice lol! Thanks for the quick reply!

I did what you recommended, edited the script as following, working perfectly now.


#!/bin/sh
#
### BEGIN INIT INFO
# Provides:             sabdaemon
# Required-Start:       $netdaemons $local_fs
# Default-Start:        3 5
# Default-Stop:         0 1 2 6
# Description:          Starts sabnzbd at system startup
### END INIT INFO
#

case "$1" in
start)
  echo "Starting SABnzbd."
  /usr/bin/sudo -u erwin -H "/home/erwin/apps/linux/sabnzbd/sabnzbd-0.4.12/SABnzbd.py" -d -f /home/erwin/.sabnzbd/sabnzbd.ini
;;
stop)
  echo "Shutting down SABnzbd."
  /usr/bin/wget -q --delete-after "http://localhost:8080/sabnzbd/api?mode=shutdown&apikey=ENTERAPIKEYHERE"
;;
*)
  echo "Usage: $0 {start|stop}"
  exit 1
esac

exit 0

Thanks again :slight_smile:

Hi

I can see that your startup script is taken from the wiki. There it says:

Below is an example start/stop script that can also be called from init.d scripts.

It is not a complete start-up script by itself. I suggest you follow hcw’s advice.

You may also want to test the relevant line of your script from the commandline first (as user root).

Too late! You solved your problem while I was writing

You are welcome.