待机后定时唤醒,本人ubuntu 14.04 LTS
测试例子:待机60秒后唤醒
sudo rtcwake -u -s 60 -m mem
写一个定时的脚本 suspend_until.sh
#!/bin/bash
# Auto suspend and wake-up script
#
# Puts the computer on standby and automatically wakes it up at specified time
#
# Written by Romke van der Meulen <redge.online@gmail.com>
# Minor mods fossfreedom for AskUbuntu
#
# Takes a 24hour time HH:MM as its argument
# Example:
# suspend_until 9:30
# suspend_until 18:45
# ------------------------------------------------------
# Argument check
if [ $# -lt 1 ]; then
echo "Usage: suspend_until HH:MM"
exit
fi
# Check whether specified time today or tomorrow
DESIRED=$((`date +%s -d "$1"`))
NOW=$((`date +%s`))
if [ $DESIRED -lt $NOW ]; then
DESIRED=$((`date +%s -d "$1"` + 24*60*60))
fi
# Kill rtcwake if already running
sudo killall rtcwake
# Set RTC wakeup time
# N.B. change "mem" for the suspend option
# find this by "man rtcwake"
sudo rtcwake -u -m mem -t $DESIRED &
# feedback
echo "Suspending..."
# give rtcwake some time to make its stuff
sleep 2
# then suspend
# N.B. dont usually require this bit
#sudo pm-suspend
# Any commands you want to launch after wakeup can be placed here
# Remember: sudo may have expired by now
# Wake up with monitor enabled N.B. change "on" for "off" if
# you want the monitor to be disabled on wake
# xset dpms force on
# and a fresh console
clear
echo "Good morning!"
chmod +x suspend_until.sh
比如早上8点半自动唤醒
suspend_until.sh 8:30
参考
http://goo.gl/apFmNA 原文中的定时脚步代码中: sudo rtcwake -l -m mem -t $DESIRED 本人已经修改成 sudo rtcwake -u -m mem -t $DESIRED
修改后的测试时间是完全正确的,只是终端命令中现实出来的时间不对,实际待机唤醒的时间是对的
分享到:
相关推荐
解释如何使用ubuntu中设置定时开关机命令的语句。
ubuntu系统配置jar项目开机自启 ubuntu系统配置jar项目开机自启 ubuntu系统配置jar项目开机自启
解决Win10与Ubuntu双系统 开机不能 进入Ubuntu的问题,更换启动项目和顺序的方法
ubuntu命令ubuntu命令ubuntu命令ubuntu命令ubuntu命令ubuntu命令
Ubuntu命令大全系统命令与网络命令
linux ubuntu系统操作命令,适应初学者
ubuntu开机自启动nginx服务
ubuntu20.04+win10双系统开机引导界面优化
Ubuntu 常用文件操作命令。列举并收集了常用的ubuntu的各种对文件的操作命令。
ubuntu系统内核参数的限制,可以自己重新设置其大点,并为永久
Ubuntu命令Ubuntu命令Ubuntu命令
对于初学Linux系统的人来说,Ubuntu是一个不错的以桌面应用为主的Linux操作系统,它对于初学Linux的人来说和友好,但是Linux的魅力就在命令操作上,这篇总结了Ubuntu系统中大多数用到的命令。
ubuntu ubuntu_设置开机自启动命令_脚本
ubuntu文件系统管理命令的解释和实例,仅供参照使用!
介绍nmcli命令。
ubuntu上的各种常用命令,非常实用。
CentOs,Ubuntu环境mkfontscale,mkfontdir命令rpm安装包
Ubuntu所有的配置己命令,适合广大Ubuntu爱好者使用
介绍了Ubuntu常用的命令和命令的拓展,非常实用