Welcome 微信登录
编程资源 图片资源库 蚂蚁家优选 PDF转换器

首页 / 操作系统 / Linux / 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 suspendNOTE: 以上是休眠到内存,就是说很多东西存到内存,这样启动快。因为是存到内存,所以必须要有电源供应。笔记本有电池就可以了。刚开始的时候,不知道那个命令可以实现休眠,因为都是点鼠标嘛。后来找到了上面的.sh文件,查看了一下内容,是个比较简单的脚本,就是写个函数,收到不同变量就执行不同的休眠方式或者reboot。脚本内容如下:CODE:#$1 = method name
execute_dbus_method ()
{
dbus-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 recognised, only suspend, shutdown, hibernate or reboot are valid"
exit 1
fi
出自:雨中的文森特 不输入用户名密码让Ubuntu自动登录到桌面Ubuntu8.04 3D桌面再欣赏相关资讯      Fedora8 
  • Fedora8下aMule和Azureus设置心得  (06/11/2008 05:56:35)
  • Fedora8 Gnome桌面环境下安装EVA   (05/13/2008 05:46:47)
  • Fedora 8下用Wine 0.9.58 跑QQ2008  (05/11/2008 13:14:05)
  • Fedora7、Fedora8、Fedora9 安装截  (06/03/2008 06:20:25)
  • Fedora 8 更新提示插入光盘问题的  (05/11/2008 16:16:55)
  • Fedora 8下DHCP获取DNS信息的问题  (05/10/2008 05:31:02)
本文评论 查看全部评论 (0)
表情: 姓名: 字数