How to schedule Linux to turn on automatically

Users can wake up their computer at any time by pressing the power button or any key on the keyboard. But what if you want it to automatically 'wake up' at a certain time?

You probably already know that you can bring your computer to Sleep mode to save a lot of power or battery on your laptop. A battery-powered device can be maintained for several 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 automatically 'wake up' at a certain time? The cause of this may be that users want to automate certain tasks, such as downloading something at 4 am, when the Internet speed may be much higher than the times. another day. With a bit of 'magic' from the command line, users can now automatically turn on Linux computers, perform some tasks, and then "sleep" again.

Besides re-enabling from standby, it is more useful to turn off the computer completely and turn on the power at certain times. Hibernation is also supported, but Linux systems use proprietary drivers that often don't "wake up" from hibernation properly.

Install Linux to automatically turn on

  1. Check if the computer supports 'wake up' options
  2. How to use rtcwake command
    1. Rtwwake Date parameter
    2. rtcwake Dry Run
    3. Energy saving method with rtcwake

Check if the computer supports 'wake up' options

Most computers will support "wake up" options, but most computers may not have the right hardware to do this. You can perform a quick test by opening the terminal and entering the following command:

 sudo rtcwake -m mem -s 30 

The computer will enter Sleep mode and 'wake up' after 30 seconds. If you want your device to be in standby mode longer, increase the number 30 to a larger value.

Also, check to see if the computer supports the 'wake up' feature after completely shutdown.

 sudo rtcwake -m off -s 60 

Regarding the -m off parameter , the user guide usually refers to the content: ' Not officially supported by ACPI, but nó thường works '. (Not officially supported by ACPI, but usually works).

If the kernel, drivers and hardware are compatible, there will be no problem. If timers are not supported, it may be because the hardware and / or BIOS / UEFI configuration does not meet the requirements. You can also try upgrading some drivers or switching from proprietary drivers to open source drivers. Maybe they will solve the problem. Alternatively, try installing a new kernel.

As mentioned earlier, hibernation has problems not related to the rtcwake command . In most cases it will work well but sometimes there are times when it fails. When it fails, the screen will remain dark or display an error message.

How to use rtcwake command

The basic usage of the command is 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 absolute time, such as 9 am tomorrow. To do that, use the --date parameter instead of -s.

Rtwwake Date parameter

 sudo rtcwake -m mem --date 09:00 

Note: Not all hardware supports setting the turn on time to the next day. Users will have to check if it works with their specific device.

Time is set in 24-hour format. The screenshot below uses the rtcwake command with different options to set the time and date for the machine to turn itself back on.

How to schedule Linux to turn on automatically Picture 1How to schedule Linux to turn on automatically Picture 1

'YYYY-MM-DD hh: mm' : year, month, day, hour and minute. For example:

 --date 2020-02-28 15:00 

means 3 pm on February 28, 2020.

Test the rtcwake command

You can add another parameter to rtcwake, -n, to display the time to turn on the machine.

 sudo rtcwake -m mem --date +12hours -n 

This is a 'dry run' command, it is not really timed but just 'pretending' to do it. Adding the -n parameter is useful when you want to check if the parameter associated with the date is set correctly. Once you make sure that this parameter is correct, simply remove the -n parameter in the command to set the actual 'wake up' time.

Energy saving method with rtcwake

The options related to the -m parameter are:

  1. -m mem - Normal standby, which the user is familiar with in the Shutdown menu.
  2. -m disk - Hibernation mode, save the memory contents to the storage device. Not recommended when using proprietary drivers.
  3. -m off - Turn off the phone normally.
  4. -m disable - Remove the previously set timer.
  5. -m no - Do not enable or set the standby mode, just set the 'wake up' event. For example, you can set the time when the computer will "wake up" tomorrow, then continue working on your computer. When you're done, turn off the device normally and the device will automatically power on in the morning.
  6. -m show - Displays 'wake up' events (previously set alarms) currently active.

You can find creative ways to use the rtcwake command. In this way, users can skip the boring boot process (this may take more than a minute on some systems). You can also install a utility, such as at, to automate the tasks that the computer runs after waking up.

Good luck!

See more:

  1. Set the time to automatically shutdown in Ubuntu with EasyShutdown
  2. How to turn off the computer automatically
  3. Set the shutdown or hibernate time for the computer
4.1 ★ | 25 Vote