script to be executed on system startup.

Dominic Fandrey kamikaze at bsdforen.de
Sat Feb 9 19:02:51 UTC 2008


Matthew Seaman wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> RW wrote:
>> On Thu, 7 Feb 2008 19:19:48 +0530
>> "navneet Upadhyay" <navneet.upadhyay at gmail.com> wrote:
>>
>>> Hi,
>>>       After putting my script to /etc/rc.d , it gets executed at
>>> startup and the parameter passed to the script is *faststart .*
>>> *I want the same script to be executed when system shuts down , how
>>> can i do that.*
>> Don't put it in /etc/rc.d/, give it a .sh extension and put it
>> in /usr/local/etc/rc.d/. It will then get stop/start arguments.
> 
> No need to force it to have a .sh extension in /usr/local/etc/rc.d/
> nowadays.  In fact, rather the contrary as a .sh extension causes the
> script to be run in the context of the rc process rather than in a 
> sub-shell.

Though undocumented, this statement is not valid for scripts in 
/usr/local/etc/rc.d. The scripts there are /always/ run in a sub-shell, no 
matter their ending.



More information about the freebsd-questions mailing list