Re: apm & auto-shutdown

From: Vesa-Pekka Palmu (vessu@dlc.fi)
Date: Wed Aug 30 2000 - 19:21:58 CEST


> Hi,
>
> Vesa-Pekka Palmu a écrit :
>
> > I remember that I once saw a little script that would sit on the
> > backround and watch /proc/apm and when the battery life would
> > drop lower that pre-determined level It would first give a warning to
> > all consoles about fortcomming shutdown (Battery life low,
> > automatic shutdown in 5 minutes) If bu that time the laptop would
> > be connected to AC-supply the shutdown would be canceled.
>
> There is a daemon (apmd) that should do that kind of stuff (is there one in
> muLinux ?). I know nothing about but have a link
>
> http://www.cut.de/bkr/linux/apmd/apmd.html
>
> But maybe you want something simpler that only look in /proc/apm every
> minute, for example. and if the state is critical sends a message to all
> consoles and halt in 5 minutes, unless the power came back ?

Well in my case I would like the shutdonw countdown to start when
the power reaches the low level (the I have about ten minutes until
it goes critical) because after the power has gone critical I have
about two minutes before the power fails.

 
> I don't know at all how to do 2 thinks in that I would like to know, if
> someone could tell me :
>
> how to have a process that sleeps for 1 minute and don't take his time slice
> during that time ? I think with the sleep command, the process still take
> his time slice to recognize it has nothing to do. (I could be wrong here).

Well anything will do for me, unless it eats all the "juice" of my
dear old 486 (clock unknow, I think that it's max 33Mhz), because
as I have told before I use it only for writing (and learning Linux,
AND getting fit [weight:4kg])
 
> The second is how to send a message to all consoles (I think it is possible
> via syslog, but it is quite overkill !).

Well if I recall correctly, the script used "shutdown -h 5min Batttery
low" or something like that (in many "big" distros that I have seen
you can send a deley to shutdown command and also a warning
message that will be echoed to all terminals. when the power
would come back the srcipt issued "shutdown -c power restored"
ore something like that to cancel the shutdown.

If my memory doesn't fail me, this srcipt was in some old
slackware distro (my first Linux installation, for a CD of a finnish
"computer magazine" (nowadays only full of game reviews,
micro$oft and brand computer tests (you know thoise computers
that you buy form a store with pre-installed bugdoze, non-standar
mainboards etc.)) I still have my copy of that CD, but I clearly
remember that the CD was ultra-low quality and I had to use five of
them to get one working set of slackware installation files :(

What are the fields of /proc/apm ???

"We are the NORN. Your life as you knew it is over. Your biological and
technological identities will be added to our own. Bibble is irrelevant.
Resistance is futile. You will be assimilated."

http://creatures2.com http://creatures.co.uk

Vesa-Pekka Palmu AKA Depili
E-mail: depili@sci.fi
ICQ#: 12379430

---------------------------------------------------------------------
To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.auc.dk
For additional commands, e-mail: mulinux-help@sunsite.auc.dk



This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:15 CET