PDA

View Full Version : Can't get local script to start at boot time


SnowRabbit
December 28th, 2008, 15:16
I have a problem

I put a script in /usr/local/etc/rc.d to start sabnzbd.
but it i will not work! When i run at the shell it works fine!

bsdrabbit# ./sabnzbd start
Starting SABnzbd.

But it will not start a boot time:( It put the x bit there! gave it 755!?

this is the script

#!/bin/sh

case "$1" in
start)
echo "Starting SABnzbd."
/usr/local/bin/SABnzbd.py -d -f /usr/sabnzbd/sabnzbd.ini
;;
stop)
echo "Shutting down SABnzbd."
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac

exit 0
Can some one please help...

graudeejs
December 28th, 2008, 15:45
have you:
your_script_enable="YES" >> /usr/local/etc/rc.conf

?

SnowRabbit
December 28th, 2008, 16:10
There was no rc.conf so i made one! still not working.
I am runnig freebsd 7

mfaridi
December 28th, 2008, 16:16
There was no rc.conf so i made one! still not working.
I am runnig freebsd 7
You can find it /etc/rc.conf

SnowRabbit
December 28th, 2008, 16:19
No i put it in /ect/rc.conf

sab_enable="YES"

name of the script="sab" location =/usr/local/etc/rc.d

SnowRabbit
December 28th, 2008, 16:21
I will not work ether way in /ect/rc.conf or the one i made in /usr/local/etc/rc.conf!

SnowRabbit
December 28th, 2008, 16:23
bsdrabbit# ./sab start
Starting SABnzbd.

It run great from the shell.. but i also don't see anything loading when freeBSD boots like that echo <Starting SABnzbd>

edogawaconan
December 28th, 2008, 16:38
try this

#!/bin/sh

. /etc/rc.subr

name="sabnzbd"
rcvar=${name}_enable

: ${sabnzbd_enable="NO"}

command=/usr/local/bin/SABnzbd.py
command_args="-d -f /usr/sabnzbd/sabnzbd.ini"

run_rc_command "$1"

SnowRabbit
December 28th, 2008, 16:40
Thanks guys it works i forget to call the .sh behind it..

Topic closed

edogawaconan
December 28th, 2008, 16:42
oh don't forget to add
sabnzbd_enable="YES"
at rc.conf

kamikaze
December 29th, 2008, 01:00
The .sh is actually dangerous. Don't do that (See rc.subr). You simply need to add the executable flag to your script: +x.