rtcwake is a command-line tool that allows users to put their Linux system into a sleep state until a specified time, relative to the BIOS clock. The sleep state can be either S3 (suspend to RAM) or S4 (hibernate). When the specified time is reached, the system will wake up and resume normal operation.
rtcwake is useful for automating power management tasks on a Linux system. For example, it can be used to schedule the system to wake up from sleep mode in the middle of the night to perform a backup or system maintenance task, and then go back to sleep after the task is complete.
rtcwake requires superuser privileges to execute, and it can be run from the command line or from a script. The syntax of the command is straightforward and consists of specifying the wakeup time and the sleep state, as well as any additional options.
One of the key features of rtcwake is its ability to wake up the system at a specific time relative to the BIOS clock, rather than the system clock. This ensures that the system will wake up at the correct time, even if the system clock has been adjusted or the system is running in a different time zone.
In conclusion, rtcwake is a useful tool for automating power management tasks on a Linux system. Its ability to put the system into a sleep state and wake it up at a specific time makes it an essential tool for system administrators and power users who need to perform tasks during non-business hours or during periods of low system usage.
rtcwake Command Examples
1. Show whether an alarm is set or not:
# sudo rtcwake -m show -v
2. Suspend to RAM and wakeup after 10 seconds:
# sudo rtcwake -m mem -s 10
3. Suspend to disk (higher power saving) and wakeup 15 minutes later:
# sudo rtcwake -m disk --date +15min
4. Freeze the system (more efficient than suspend-to-RAM but version 3.9 or newer of the Linux kernel is required) and wakeup at a given date and time:
# sudo rtcwake -m freeze --date YYYYMMDDhhmm
5. Disable a previously set alarm:
# sudo rtcwake -m disable
6. Perform a dry run to wakeup the computer at a given time. (Press Ctrl + C to abort):
# sudo rtcwake -m on --date hh:ss