[Pkg-sysvinit-devel] Bug#577146: Logic of halt script, with regard to ups-monitor, is wrong

Regid Ichira gl2n30y06arv2 at hotmail.com
Sun Jun 6 10:55:23 UTC 2010


> [Regid Ichira]
>> Suppose a user set HALT=poweroff in /etc/default/halt, and also set
>> /etc/init.d/ups-monitor because he has a ups. With the current halt
>> script, won't the end result be that the ups will always be
>> requested to cut the power?
>
> Isn't that the expected behaviour? Can you explain more? I fail to
> understand the problem and do not see why your patch improve anything.
> I do not really know the ups-monitor interaction with the Debian
> shutdown scripts, so I need smaller tea spoons. :)
>


  This is my understanding:

1. Any user, not just someone with a ups, can choose one of halt or
   poweroff setting in /etc/default/halt.  Where halt means: halt the
   machine, but keep a low energy source to allow wake on lan, or a
   somewhat faster boot.  And poweroff means just that: turn off the
   machine.  I also think that poweroff was added about 10 or 15 years
   ago, with the advent of main boards and laptops.

   Note that the /etc/init.d/halt has the following:

        # If INIT_HALT=HALT don't poweroff.
        poweroff="-p"
        if [ "$INIT_HALT" = "HALT" ]
        then
                poweroff=""
        fi

2. Someone with a ups might want, in addition, to transfer control to
   the ups.  The circumstances to transfer control to the ups might be
   for testing purposes, or when it is determined that there is a
   power failure.

As a result, I think that the required ups-monitor interaction in the
shutdown script is:

     do
    1. The machine is operating normally.
    2. In the process, a ups-monitor software, if there is one,
       monitors the power.  The ups-monitor software might initiate
       a shutdown process.  While doing so, it will keep a flag
       indicating that it has determined that a shutdown process is
       required.
     until [ Something initiates a shutdown process ]

Kill the processes.  Shutdown is almost completed.

     if [ there is a ups-monitor software ]
    # and the machine is at the end of a shutdown process
    Have the ups-monitor software determine whether
    the conditions are such that it has to do something
    with the ups.  It is likely to test whether it set a flag
    indicating that it has initiated a shutdown process.

     else  # or the ups-monitor software determined it does not interfere
    Continue with the shutdown process as if there is no
    ups-monitor software.

  This allow the ups to have the machine start over again as soon as
main power is back.
 		 	   		  
_________________________________________________________________
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
https://signup.live.com/signup.aspx?id=60969




More information about the Pkg-sysvinit-devel mailing list