atom feed29 messages in org.freebsd.freebsd-questionsscript to be executed on system startup.
FromSent OnAttachments
navneet UpadhyayFeb 6, 2008 6:09 am 
Pietro CeruttiFeb 6, 2008 6:22 am 
Derek RagonaFeb 6, 2008 6:22 am 
Wojciech PucharFeb 6, 2008 6:31 am 
navneet UpadhyayFeb 6, 2008 6:33 am 
Derek RagonaFeb 6, 2008 6:44 am 
Ivan VorasFeb 6, 2008 6:53 am 
Ivan VorasFeb 6, 2008 6:59 am 
Wojciech PucharFeb 6, 2008 7:35 am 
Zbigniew SzalbotFeb 6, 2008 7:39 am 
Jerry McAllisterFeb 6, 2008 7:40 am 
Jerry McAllisterFeb 6, 2008 7:46 am 
Jerry McAllisterFeb 6, 2008 7:52 am 
Zbigniew SzalbotFeb 6, 2008 7:54 am 
Wojciech PucharFeb 6, 2008 8:49 am 
Zbigniew SzalbotFeb 6, 2008 8:51 am 
Alex ZbyslawFeb 6, 2008 9:22 am 
Jerry McAllisterFeb 6, 2008 9:29 am 
Paul SchmehlFeb 6, 2008 9:35 am 
Ivan VorasFeb 6, 2008 9:52 am 
Dominic FandreyFeb 6, 2008 10:50 am 
RWFeb 6, 2008 10:56 am 
RWFeb 6, 2008 11:03 am 
Ivan VorasFeb 7, 2008 2:16 am 
navneet UpadhyayFeb 7, 2008 5:49 am 
RWFeb 9, 2008 10:10 am 
Matthew SeamanFeb 9, 2008 10:22 am 
Dominic FandreyFeb 9, 2008 11:02 am 
RWFeb 9, 2008 7:03 pm 
Subject:script to be executed on system startup.
From:navneet Upadhyay (navn@gmail.com)
Date:Feb 7, 2008 5:49:31 am
List:org.freebsd.freebsd-questions

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.* ** *i want to do something like this in script :- * ** *if [$1 = "faststart"]; then* *start my executables* *elif * *stop my executables* *fi* ** *question is :-* ** *How to excute a script when system comes up and shuts down with differnt parameter.* ** *Thanks,* *navneet*

On 2/6/08, Dominic Fandrey <kami@bsdforen.de> wrote:

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.

How can i add it to rc.conf file, is there any command?

There have been a lot of suggestions here and the thread contains all the valid information, but some people have given you deprecated advice. So I'll try to clarify what can be done and how it's meant to be done.

1. Your own scripts belong int /usr/local/etc/rc.d, if you update your system it will suggest to delete all custom scripts from /etc/rc.d, because it's only for scripts from the base system. Remember that path will not be set when your script is called at startup. The usual approach is to only use fully qualified filenames.

2. All executable scripts in /usr/local/etc/rc.d are executed at startup and given the parameter start. Upon shutdown the parameter stop is given. The name of the script does not matter.

3. To this point you have all the functionality you asked for and there is no need for you to look further. However you are at liberty to instead build a compliant rc.d script, which brings you the advantages of controlling the execute order by defining dependencies and being able to activate/deactivate scripts and additional parameters in the file /etc/rc.conf. If you wish to exploit these advanced features it's a good way to look at existing scripts in /usr/local/etc/rc.d and read the rc(8) manual page.