Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there any way to configure shutdown on critically low battery to give me a bit of time before actually shutting down?

I've set GNOME Power Manager to shutdown on low battery (hibernating does not work on my netbook). Problem is, I don't get any notification about battery running low, and as soon as battery level reaches the critical threshold, the system quickly kills applications and shuts down without me having any chance to quickly complete some tasks and/or save some data. Of course, I'd increase battery level thresholds to gain some more time to accomplish such tasks.

If some other window manager has a more advanced power management facility than GNOME, I'm also willing to switch.

share|improve this question
    
What versıon of Gnome are you running? 2.x or 3.x? –  Caleb Jul 17 '11 at 6:53
    
@Caleb Gnome 2.30.2. –  Elena Feb 4 '12 at 16:49

1 Answer 1

up vote 3 down vote accepted

I don't use it, but a few google searches and it looks like GNOME Power Manager isn't that configurable (i.e., there are reports that it doesn't allow any customization).

That being the case I'd recomend switching to something else (e.g, acpid, hal, devicekit-power, etc.) that is scriptable.

Find (or create) the script that runs on the low battery event and use zenity to give yourself a warning, schedule a shutdown.

zenity --warning --title "Battery" --text "Low battery. (state = $state)" &
shutdown -h -t 300

The 300 gives you 5 minutes (customize this for your needs).

There will also be an "ac" event, when you plug into AC power. You'll want this event to cancel any pending shutdown.

shutdown -c

Sorry it's not a complete solution, but there are many ways to do this.

share|improve this answer
    
I prefer sudo bash -c ' sleep 300; shutdown -h -t 5' so the shutdown by GUI is not denied for the user. –  totti Jan 13 at 16:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.