# Start script at boot time



## SnowRabbit (Dec 26, 2008)

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

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

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

http://www.freebsd.org/doc/en_US.ISO8859-1/articles/rc-scripting/ might be interesting for you to read.


----------



## SnowRabbit (Dec 27, 2008)

Thanks is clear now! i understand it:e and it works


----------

