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.

Rance Hall ranceh at gmail.com
Fri Apr 4 20:46:23 UTC 2008


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.

for example, once a login prompt appears there should be a getty running.

prior to that time there shouldnt be a getty running, and if there
isnt a gettty running, then the script must be called from the rc
process and therefore I can do X instead of Y which I do when the
system is fully operational.

This is my thought process but I dont understand how to carry it out,
or if the thought process actually makes sense.

is there a better way for me to do what Im trying to do, and if there
isnt and Im on the right track, how do I do what Im asking?


More information about the freebsd-questions mailing list