PDA

View Full Version : Start script at boot time


SnowRabbit
December 26th, 2008, 23:44
Hello,

I want to run my shell script when my freeBSD 7 machine starts. The script works perfect when i run it manually as daemon.

This is the script
-----------START------------------
#!/bin/sh

case "$1" in
start)
echo "SABnzbd Gestart!."
sudo -u root -H /usr/local/bin/SABnzbd.py -d -f /root/.sabnzbd/sabnzbd.ini
;;
stop)
echo "SABnzbd Gestopt!."
reboot
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac

exit 0
-----------END------------------

I put the script in rc.d and called it sabnzbd and add the line in rc.conf --> sabnzbd_enable="YES"
But i am still missing a step.
i sad no settings start or stop ect. Can some body help a this point?.

Greetz SnowRabbit

Lowell
December 26th, 2008, 23:53
Your script doesn't have all of the rcorder(8) keywords, so it won't be treated the same way as the scripts that are. See the manual page at http://www.freebsd.org/cgi/man.cgi?query=rcorder&format=html" for all of the details.

SnowRabbit
December 27th, 2008, 00:28
I still not complety clear but i guess i need to use PROVIDE: start or something.Because when i boot i ask usage: /etc/rc/ {start:stop}
But thanks for your manual page link.

danger@
December 27th, 2008, 03:12
http://www.freebsd.org/doc/en_US.ISO8859-1/articles/rc-scripting/ might be interesting for you to read.

SnowRabbit
December 27th, 2008, 10:11
Thanks is clear now! i understand it:e and it works