TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:20740] Magic runlevels



Dave Sherohman wrote:
> 
> Jon Schewe said:
> > Actually it is in rc0.d, look at the halt script.
> 
> *sigh*  There it is...  I just scanned the directory quickly and missed it.
> (If I'd been thinking, I would've just looked at the last S entry - not much
> point in trying to do anything else after shutting down, after all...)
> 
> > It calls halt -p -d -f, at
> > least it does on my system, SuSE 6.4.
> 
> Basically the same here, except Debian adds a -i also.  ("Shut down all
> network interfaces just  before  halt or reboot.")

And of course redhat makes things as complex as possible:

# See how we were called.
case "$0" in
  *halt)
        message="The system is halted"
        command="halt"
        ;;
  *reboot)
        message="Please stand by while rebooting the system..."
        command="reboot"
        ;;
  *)
        echo "$0: call me as \"rc.halt\" or \"rc.reboot\" please!"
        exit 1
        ;;
esac

(bunch of stuff for killing off processes, unmounting filesystems and
misc other things cut out)

# Now halt or reboot.
echo "$message"
if [ -f /fastboot ]; then
 echo "On the next boot fsck will be skipped."
elif [ -f /forcefsck ]; then
 echo "On the next boot fsck will be forced."
fi

HALTARGS="-i -d"
if [ -f /poweroff -o ! -f /halt ]; then
 HALTARGS="$HALTARGS -p"
fi

eval $command $HALTARGS