Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Apr 2008 00:38:06 +0100
From:      Andrew Cid <andrew@accid.net>
To:        Rance Hall <ranceh@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: 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.
Message-ID:  <20080404233806.GA24899@farnborough.darq.net>
In-Reply-To: <845c0f80804041321j44439881yb67458980edab102@mail.gmail.com>
References:  <845c0f80804041321j44439881yb67458980edab102@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 

[1] http://www.freebsd.org/doc/en/articles/rc-scripting/index.html
-- 
andrew@accid.net




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080404233806.GA24899>