Power management

Asked by Peter

I have a question about
System-->Preferences-->Power Management

Does anyone know in what configuration file the values collected are stored?
I want to allow 4 hours before hibernation for doing system updates on dialup at night time.

Thanks
Peter

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Tobias Wolf
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
Tony Mugan (tmugan) said :
#1

This posting in the FAQ might help you write a script to inhibit the power saving features while another process is at work.

http://live.gnome.org/GnomePowerManager/FAQ#head-1cf52551bcec3107d7bae8c332fd292ec2261760

Revision history for this message
Peter (nitep) said :
#2

Hi Tony,
I am hoping I can just change a value in a config file to delay hibernating for 4 hours instead of the max 1 hour in the gui of System-->Preferences-->Power Management
My ISP disconnects users after 4 hours but at night that would allow quite a few updates to be downloaded. I had a look at the web page you mentioned, but I think I need more info to be able to do that.
Thanks
Peter

Revision history for this message
Tobias Wolf (towolf) said :
#3

The setting is stored in the Gconf key /apps/gnome-power-manager/timeout/sleep_computer_ac in seconds.
You can edit this value with Gconf-Editor, but if it will use the value is not clear.

You can also do it by hand before leaving the computer:

echo "pm-hibernate" | at 23:00

or

echo "pm-hibernate" | at now + 4hours

You can also file an enhancement request here: http://bugzilla.gnome.org/

Revision history for this message
Peter (nitep) said :
#4

Thanks Tobias Wolf, that solved my question.

Revision history for this message
Peter (nitep) said :
#5

Sorry Tobias,
I was to quick to say problem solved.
I used gconf-editor to set the hibernate time to 720 seconds.
I then looked at the System-->Preferences-->Power Management GUI and saw that it showed 12 minutes. That is why I thought the problem was solved. Since then I used gconf-editor to set the hibernate time to 3610 seconds, just past the GUI max 1hour. The GUI showed never as the hibernate time. I left the computer for over 1 hour but it did not hibernate. ( By the way it does hibernate okay if the GUI is set to 1 hour or less)

I then tried
peter@peter-desktop:~$ gconf-editor
peter@peter-desktop:~$ echo "pm-hibernate" | at now + 2minutes
warning: commands will be executed using /bin/sh
job 1 at Thu Jul 17 12:13:00 2008
peter@peter-desktop:~$

But it still did not hibernate. The GUI still showed never from the 3610 seconds trial. I set the GUI to 1 hour and repeated the 2 minute trial but it still did not hibernate.

This was in the system log from the first 2 minutes trial

Jul 17 12:13:00 peter-desktop atd[6012]: Exec failed for mail command: No such file or directory

/bin/sh does exist.
That is the only 12:13 entry. Can you see what is wrong?

Thanks
Peter

Revision history for this message
Best Tobias Wolf (towolf) said :
#6

As I thought. I think g-p-m interprets any value higher than 3600 as "Never", so there no way no game it with the Gconf editor. You might file a bug in Gnome Bugzilla to point out your use case.

Secondly, the error you got from the "at" command is that it cannot mail you back the results of running your command. This is because you have no mail server installed. This is normal, Ubuntu doesn’t install a mail server on a normal desktop.
What I think it wanted to mail you is that you, as a normal user, don’t have permission to run pm-hibernate. I don’t know why that is, but the program is in /usr/sbin/pm-hibernate; and "sbin" indicates administrative "root-only" programs.
Anyhow, the Power Management applet is not root either, so how does it send the computer to sleep? I figured this must be a signal sent over the DBus (something like a pneumatic tube post for your programs).

I can’t test this stuff b/c my PC wouldn’t hibernate. So does this work better?

echo "dbus-send --system --print-reply --dest=org.freedesktop.Hal \
 /org/freedesktop/Hal/devices/computer \
org.freedesktop.Hal.Device.SystemPowerManagement.Hibernate" \
| at now + 2minutes

This send the "go to hibernation now!" signal over Dbus to the right place.
And the 'echo "xyz" | at now +2minutes' delays the execution of the sending until the time has elapsed. The was you run a command with "at" is very strange, don’t bother with it.

Revision history for this message
Peter (nitep) said :
#7

Hi Tobias,
That works with 2 minutes and also with 61 minutes.(greater than the dreaded 1 hour max) That is with GUI prefs set to never hibernate so it should also work with 4 hours.
That will make my updates much more bearable with dialup. I have sent an enhancement request to Gnome Bugzilla asking for an option in the update manager to shut down the computer when updates are completed and giving more time to the update manager before exiting after a disconnection. It takes longer for the auto reconnect than the update manager allows.

Thanks very much for your time and trouble,
Regards,
Peter

Revision history for this message
Peter (nitep) said :
#8

Thanks Tobias Wolf, that solved my question.