need a shell script that can be executed manually or as part of the rc process. How can the script detect WHERE it is being called from to know how to handle various options.

Andrew Cid andrew at
Fri Apr 4 23:34:45 UTC 2008

Hi Rance,

> I have a sh script im working on that is going to be able to run by
> the init/rc process.  That same script can also be run after the
> system is started.
> I need a way to have the sh script detect WHERE in the boot process
> the server is when it is being executed.

You can control when your rc script runs with #REQUIRE: and #BEFORE:

Checkout the practical rc.d scripting article [1], chapter 7 has an
example.  Use rcorder(8) to see what runs when:

$ rcorder /etc/rc.d/*

Hope this helps,


andrew at

More information about the freebsd-questions mailing list