# Can't get local script to start at boot time



## SnowRabbit (Dec 28, 2008)

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 (Dec 28, 2008)

have you:
*your_script_enable="YES" >> /usr/local/etc/rc.conf*

?


----------



## SnowRabbit (Dec 28, 2008)

There was no rc.conf so i made one! still not working.
I am runnig freebsd 7


----------



## mfaridi (Dec 28, 2008)

SnowRabbit said:
			
		

> 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 (Dec 28, 2008)

No i put it in /ect/rc.conf

sab_enable="YES"

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


----------



## SnowRabbit (Dec 28, 2008)

I will not work ether way in /ect/rc.conf or the one i made in /usr/local/etc/rc.conf!


----------



## SnowRabbit (Dec 28, 2008)

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 (Dec 28, 2008)

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 (Dec 28, 2008)

Thanks guys it works i forget to call the .sh behind it..

Topic closed


----------



## edogawaconan (Dec 28, 2008)

oh don't forget to add 

```
sabnzbd_enable="YES"
```
at rc.conf


----------



## kamikaze (Dec 29, 2008)

The .sh is actually dangerous. Don't do that (See rc.subr(8)). You simply need to add the executable flag to your script: [cmd=chmod]+x[/cmd].


----------

