Fedora8实现定时休眠到内存-suspend to ram

在Windows下面有一个软件叫做eyeauard-眼睛卫士,可以设定每过一定时间自动锁定你的笔记本,强迫让你休息,对于整天伏案工作的人真的是必备工具。

现在切换到Fedora平台后,一直希望找到这样的工具,现在好像还没有,偶尔想到可以通过电源管理中的休眠,配合定时任务,让笔记本定时休眠就可以了,防止很多时候,一工作起来就忘记时间了。

我的OS:Fedora8

安装gnome-power-manager就可以了,一般默认都有的

vim /etc/crontab

添加如下:

0 8-18 * * * root /usr/bin/gnome-power-cmd.sh suspend

NOTE: 以上是休眠到内存,就是说很多东西存到内存,这样启动快。因为是存到内存,所以必须要有电源供应。笔记本有电池就可以了。

刚开始的时候,不知道那个命令可以实现休眠,因为都是点鼠标嘛。后来找到了上面的.sh文件,查看了一下内容,,是个比较简单的脚本,就是写个函数,收到不同变量就执行不同的休眠方式或者reboot。

脚本内容如下:

CODE:#$1 = method nameexecute_dbus_method (){dbus-send –session –dest=org.freedesktop.PowerManagement \–type=method_call –print-reply –reply-timeout=2000 \/org/freedesktop/PowerManagement \org.freedesktop.PowerManagement.$1if [ $? -eq 0 ]; thenecho “Failed”fi }

if [ “$1” == “suspend” ]; thenecho “Suspending”execute_dbus_method “Suspend”elif [ “$1” == “hibernate” ]; thenecho “Hibernating”execute_dbus_method “Hibernate”elif [ “$1” == “reboot” ]; thenecho “Rebooting”execute_dbus_method “Reboot”elif [ “$1” == “shutdown” ]; thenecho “Shutting down”execute_dbus_method “Shutdown”elif [ “$1” == “” ]; thenecho “command required: suspend, shutdown, hibernate or reboot”elseecho “command ‘$1’ not recognised, only suspend, shutdown, hibernate or reboot are valid”exit 1fi

出自:雨中的文森特

然后继续努力,把让自己跌倒的石头搬掉或绕过去,不就解决问题了吗

Fedora8实现定时休眠到内存-suspend to ram

相关文章:

你感兴趣的文章:

标签云: