Actually, I took a look at the source of apmd. Now I think I have a
really easy solution. 

apmd calls sync() just after the button has
been pressed. Instead of executing sync, I guess one could do
whatever else (execute some script or something), buy simply changing
the source.

Regards,

/Edin       <º))))><

"A man flattened by an opponent can get up again.
 A man flattened by conformity stays down for good." 
 (T. Watson Jr.)
On Sat, 10 Jul 1999, Jos Beck wrote:

> Edin Bektesevic wrote:
>  
> > Another question on this subject: Is there any way to trap the event
> > of user pressing (and holding down) the OFF button? The good thing to
> > do would be to e.g. run a script unmounting all filesystems and
> > shutting down cleanly.
> 
> We have considered such shutdown button in the beginning. It can be
> implemented very simply. Monitor an input (e.g. an input of an unused
> serial (e.g. DCD) or parallel port.
> Connect the "shutdown button" to this input. Run a shutdown sript as
> soon as the state on the input changes. The power supply is connected
> via a relay which is held up by an output
> (e.g. an output pin of the unused serial port (e.g. DTR). At the end of
> the shutdown script, bring this output (and thus the relay down) and
> thats it. The relay is switched on by both the switch and the output
> (logical or). etc.. So before booting the switch
> 
> HOWEVER: this does not help you when you pull the plug instead of
> plipping the switch.
> So we abandoned the idea :)
> Now we just mount rw a little partition for configuration data and make
> sure it is written immediately. The rest stays ro.
> 
> Jos Beck
> 

Reply via email to