script to be executed on system startup.
ivoras at freebsd.org
Wed Feb 6 14:54:11 UTC 2008
navneet Upadhyay wrote:
> I have a script file, i want that script to be executed on system
> I am doing this on Linux in following two steps : -
> 1. Copying the script to /etc/rc.d directory.
> 2. /sbin/chkconfig --add "scriptname"
> I want to achieve the same on FreeBSD
> chckconfig file is not present, documentation says i have to add it to
> rc.conf file.
I've seen some complicated examples on this thread, and want to suggest
a simple one:
1. create a regular shell script in /etc/rc.d, name it whatever you like
(for example: "/etc/rc.d/myscript")
2. chmod a+x the script
3. you're done.
This will work for the recent versions of FreeBSD (you didn't say for
which version do you need it).
A more semantically pure example (and the one that's preferred if your
script starts an external application - a web server or something like
that) is to put the script in /usr/local/etc/rc.d. In any case, the
syntax and everything else is the same.
An advanced feature is to regulate when the script will be executed (in
Linux, this is accomplished by all those ugly symlinks like
S86Something). Here it is done by adding special comments to the
beginning of the file in the format
# AFTER: FILESYSTEMS
# BEFORE: LOGIN
See rcorder(8) man page for details.
(most of the advices given here will also work on NetBSD).
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20080206/ef08ab56/signature.pgp
More information about the freebsd-questions