Surely you already know you can put your computer into sleep mode to save significantly energy or battery on your laptop. A battery-powered device can last for days in standby mode because the amount of energy consumed in this state is extremely low.
Users can “wake up” the computer at any time by pressing the power button or any key on the keyboard. But what if you want it to “wake up” automatically at a certain time? The cause of this may be that users want to automate certain tasks, such as downloading something at 4 a.m., when the Internet speed could be much higher than at times. other of the day. With a bit of magic from the command line, users can schedule a Linux computer to automatically turn on, do some work, and then “sleep” again.
Besides turning it back on from standby, it’s more helpful to completely turn off the computer and power on at certain times. Hibernation is also supported, but Linux systems that use a proprietary driver often do not “wake up” from hibernation properly.
Check to see if the computer supports the “wake-up” options
Most computers will support the “wake-up” options, but chances are some don’t have the right hardware to do this. A quick test can be done by opening a terminal and entering the following command:
sudo rtcwake -m mem -s 30
The computer will go into sleep mode and “wake up” after 30 seconds. If you want the device to stay in standby mode for longer, increase the number 30 to a larger value.
Also, check if the computer supports the “wake up” feature after a complete shutdown.
sudo rtcwake -m off -s 60
Regarding the -m off parameter, the manual section usually mentions the content: “Not officially supported by ACPI, but it usually works”. (Not formally supported by ACPI, but usually still works).
If the kernel, drivers and hardware are all compatible, no problem will happen. If the timers are not supported, it may be because the hardware and / or the BIOS / UEFI configuration does not meet the requirements. You could also try upgrading some drivers or switching from proprietary to open source drivers. Maybe they will solve the problem. Alternatively, try installing a new kernel.
As mentioned before, hibernation has issues that are not related to the rtcwake command. In most cases it will work well but there are times when it fails. When it fails, the screen will remain dark or show an error message.
How to use the rtcwake command
The basic usage of the command is very simple: Choose a method to save energy and the time the computer “wakes up”. In the previous command, the -s parameter was used to specify the number of seconds before the computer turned on again. But usually, users will want to specify an absolute time, such as 9am tomorrow. To do that, use the –date parameter instead of -s.
The rtcwake Date parameter
sudo rtcwake -m mem --date 09:00
Note: Not all hardware supports the next day’s re-enable time setting. The user will have to check if it works with his particular device.
The time is set in 24-hour format. The screenshot below shows you how to use the rtcwake command with different options to set the time and date for the machine to turn on again.
“YYYY-MM-DD hh: mm“: year, month, day, hour and minute. For example:
--date 2020-02-28 15:00
means 3pm February 28, 2020.
Test the command rtcwake
You can add another parameter to rtcwake, -n, to display the turn-on timer time
sudo rtcwake -m mem --date 12hours -n
This is a “dry run” command, it doesn’t actually timer, it just “pretends” to do it. Adding the -n parameter is useful when you want to check if the parameter relative to the set date is correct. Once you are sure that the parameter is correct, simply omit the -n parameter in the command to set the actual wake-up time.
Energy saving method with rtcwake
Các tùy chọn có liên quan đến tham số -m là:
-m mem – Normal standby, something that users are familiar with in the Shutdown menu.
-m disk – hibernation mode, save memory contents to storage device. Not recommended when using proprietary drivers.
-m off – Normal shutdown.
-m disable – Cancels the timer set previously.
-m no – Don’t turn on or set the device to standby, just set the “wake up” event. For example, you can set the time the computer “wakes up” tomorrow morning, then resumes working on your computer. When you’re done, turn off the computer normally and the device will power on automatically in the morning.
-m show – Shows the currently active “wake-up” (alarm set) events.
You can find creative ways to use the rtcwake command. This way users can skip the boring boot process (this can take more than a minute on some systems). You can also install a utility, such as at, to automate tasks that your computer runs after waking up.