navneet Upadhyay wrote: > Hi, > I have a script file, i want that script to be executed on system > startup. > > 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 or # BEFORE: LOGIN See rcorder(8) man page for details. (most of the advices given here will also work on NetBSD).
Description: OpenPGP digital signature