Boot script query ( /etc/rc.d/rc.S/M/0)
Got a query on some odd scripting in the boot up/ shutdown scripts, these scripts in turn call other scripts in /etc/rc.d but do so in an odd way and I want to know why this is, if you look in /etc/rc.d/rc.M the way the scripts are called is different
hal is called by Code:
sh /etc/rc.d/rc.hald start Code:
. /etc/rc.d/rc.acpid start Code:
/etc/rc.d/rc.cups start Code:
# Run any local shutdown scripts: |
Including other rc scripts through the use of the "source" command (which is the dot command's actual name) saves creating a sub-shell. Forking a subshell adds a little bit of overhead to your boot time.
However, if the script which gets sourced contains an "exit" statement it becomes a different story. Look at the rc.hald script which checks for the existence of dbus and aborts with "exit 1" if dbus is not found. Now, if rc.hald would have been sourced it would be effectively part of rc.M. The "exit 1" statement would then abort rc.M as well, the result would be a broken system because most of rc.M would not be executed. Therefore, rc.hald is started in a subshell so that in case of that error exit, rc.M can just continue with the other bits and pieces. Eric |
Thanks! didn't think to check for an exit statement in the scripts, but it still seems odd to mix the two different ways of running the rc scripts just to save a small bit of boot time.
|
All times are GMT -5. The time now is 08:04 AM. |