以下是在OpenSuse上所做的测试

whereis rtcwake
rtcwake: /usr/sbin/rtcwake /usr/share/man/man8/rtcwake.8.gz

rtcwake --help
Usage:
 rtcwake [options]

Options:
 -d, --device <device>    select rtc device (rtc0|rtc1|...)
 -n, --dry-run            does everything, but suspend
 -l, --local              RTC uses local timezone
 -m, --mode <mode>        standby|mem|... sleep mode
 -s, --seconds <seconds>  seconds to sleep
 -t, --time <time_t>      time to wake
 -u, --utc                RTC uses UTC
 -v, --verbose            verbose messages

 -h, --help     display this help and exit
 -V, --version  output version information and exit

For more details see rtcwake(8).

 standby

普通待机模式,为默认选项,对应ACPI  state S1

 mem

待机到内存,即内存之外把其他设备都进入低功耗模式,对应ACPI state S3

 disk

待机到硬盘,即休眠,把电脑的当前状态保存到硬盘,几乎不消耗外部电源,对应ACPI state S4

off 

通过调用系统的关机命令来休眠, 对应ACPI state S5


可以通过以下命令查阅当前系统支持的休眠模式

cat /sys/power/state
standby mem disk


我的电脑目前支持以上三种,但是测试发现休眠到disk的时候,机器会迅速醒来,standby和mem两种模式则工作正常,个中原因还不清楚。


执行该命令的时候需要root权限

1. 系统休眠后20seconds唤醒,加-v选项可以看到更多的打印信息

sudo rtcwake -v -s 20 -m mem 或

sudo rtcwake -v -s 20 -m standby

打印信息:

rtcwake -v -s 20 -m mem
Using UTC time.
delta   = 0
tzone   = 0
tzname  = UTC
systime = 1393296617, (UTC) Tue Feb 25 02:50:17 2014
rtctime = 1393296617, (UTC) Tue Feb 25 02:50:17 2014
alarm 0, sys_time 1393296617, rtc_time 1393296617, seconds 20
rtcwake: wakeup from "mem" using /dev/rtc0 at Tue Feb 25 02:50:38 2014
suspend mode: mem; suspending system


2. 系统在指定的时间醒来

rtcwake -v -t `date -d 10:53 +%s` -m mem
Using UTC time.
delta   = 0
tzone   = 0
tzname  = UTC
systime = 1393296754, (UTC) Tue Feb 25 02:52:34 2014
rtctime = 1393296754, (UTC) Tue Feb 25 02:52:34 2014
alarm 1393296780, sys_time 1393296754, rtc_time 1393296754, seconds 0
rtcwake: wakeup from "mem" using /dev/rtc0 at Tue Feb 25 02:53:00 2014
suspend mode: mem; suspending system


rtcwake -v -t `date -d 10:54 +%s` -m standby
Using UTC time.
delta   = 0
tzone   = 0
tzname  = UTC
systime = 1393296794, (UTC) Tue Feb 25 02:53:14 2014
rtctime = 1393296794, (UTC) Tue Feb 25 02:53:14 2014
alarm 1393296840, sys_time 1393296794, rtc_time 1393296794, seconds 0
rtcwake: wakeup from "standby" using /dev/rtc0 at Tue Feb 25 02:54:00 2014
suspend mode: standby; suspending system


如果发现systime 和rtctime时间不一致,需要利用hwclock进行调整。

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐