In Windows, there is a software called eyeauard-eye guard, which can set to automatically lock your notebook every time and force you to rest. It is really a necessary tool for people working at the desk all day. After switching to the Fedora platform, I have always hoped to find such a tool. Now it seems that I have not, and occasionally think that I can use sleep in Power Management to work with scheduled tasks to make my notebook sleep regularly, in many cases, you may forget the time when you work. My OS: Fedora8 install gnome-power-
In Windows, there is a software called eyeauard-eye guard, which can set to automatically lock your notebook every time and force you to rest. It is really a necessary tool for people working at the desk all day.
After switching to the Fedora platform, I have always hoped to find such a tool. Now it seems that I have not, and occasionally think that I can use sleep in Power Management to work with scheduled tasks to make my notebook sleep regularly, in many cases, you may forget the time when you work.
My OS: Fedora8
Install gnome-power-manager.
Vim/etc/crontab
Add as follows:
0 8-18 *** root/usr/bin/gnome-power-cmd.sh suspend
NOTE: The above is sleep to the memory, that is, a lot of things are stored in the memory, so that the startup is fast. Because it is stored in the memory, there must be a power supply. The laptop has a battery.
At the beginning, I didn't know that command could be used to sleep, because it was just a mouse click. Later, I found the above. sh file and checked the content. It was a relatively simple script, namely, writing a function, and executing different sleep methods or reboot upon receiving different variables.
The script content is as follows:
CODE: #$1 = method name
Execute_dbus_method ()
{
Sending-send -- session -- dest = org. freedesktop. PowerManagement \
-- Type = method_call -- print-reply -- reply-timeout = 2000 \
/Org/freedesktop/PowerManagement \
Org. freedesktop. PowerManagement. $1
If [$? -Eq 0]; then
Echo "Failed"
Fi
}
If ["$1" = "suspend"]; then
Echo "Suspending"
Execute_dbus_method "Suspend"
Elif ["$1" = "hibernate"]; then
Echo "Hibernating"
Execute_dbus_method "Hibernate"
Elif ["$1" = "reboot"]; then
Echo "Rebooting"
Execute_dbus_method "Reboot"
Elif ["$1" = "shutdown"]; then
Echo "Shutting down"
Execute_dbus_method "Shutdown"
Elif ["$1" = ""]; then
Echo "command required: suspend, shutdown, hibernate or reboot"
Else
Echo "command '$ 1' not recognized, only suspend, shutdown, hibernate or reboot are valid"
Exit 1
Fi
From: Vincent in the rain