[Pkg-sysvinit-devel] Re: Fixing hwclock.sh

Thomas Hood jdthood at yahoo.co.uk
Fri Jan 6 15:20:28 UTC 2006


Petter Reinholdtsen wrote:
> [Henrique de Moraes Holschuh]
>> Can either init itself or rc be teached to run sulogin and reboot if
>> the regular rc runlevel scripts execution borks in any way?  One or
>> two forks before we run the whole thing is not bad if it increases
>> resiliency, even if that means one extra process sitting around.
> 
> Perhaps we should do something like this?  It will run sulogin if exit
> is used while the script is executed, and:
> 
>   on_exit() {
>     sulogin
>   }
>   trap on_exit EXIT # Enable emergency handler
> 
>   [...]
> 
>   trap - EXIT # Disable emergency handler
>   exit 0 # Exit normally
> 
> Is this working with all bourne shells?  I believe so, but am not
> sure.


http://www.opengroup.org/onlinepubs/009695399/utilities/trap.html
The Open Group Base Specifications Issue 6
IEEE Std 1003.1, 2004 Edition

NAME

    trap - trap signals

SYNOPSIS

    trap [action condition ...]

DESCRIPTION

    If action is '-', the shell shall reset each condition to the default value.
    If action is null ( "" ), the shell shall ignore each specified condition if
    it arises. Otherwise, the argument action shall be read and executed by the
    shell when one of the corresponding conditions arises. [...]


I think that something like this would be good.
-- 
Thomas



More information about the Pkg-sysvinit-devel mailing list