- dotTech - https://dottech.org -

How to make Linux PC wake from sleep automatically [Tip]

If you want to put your Linux computer to sleep or be in hibernation mode and automatically have it back up and working at a specific time. It is more than simple and easy and you can easily achieve that by using a simple command called rtcwake which is encompassed by default with the Linux OSes.This feature can be valuable if you want the computer to do some specific work at some specific time but you do not want it running seamless without any purpose. Here are the steps to achieve that:sleep-wake-rtcwake-worked

Using rtcwake

On Ubuntu type following command in terminal to activate rtcwake.

    sudo rtcwake -m [type of suspend] -s [number of seconds]

After activating it type below command which basically suspends your system and wakes it back up 60 seconds later:

    sudo rtcwake -m disk -s 60

Types of Suspend

The -m switch which we have used in earlier commands offers following types of suspend

You can also use the option –t which basically allows the computer to wake up at certain time. This -t switch just wants the number of seconds.

While the -l switch conveys the rtcwake that the HW clock is fixed to local time, whereas the -u switch expresses rtcwake the hardware clock that is in your computer’s BIOS is established to UTC time. Linux providers frequently establish the hardware clock to UTC time and interpret it to the local time.

Tips & Tricks

You can use && operator to run an explicit commands after rtcwake wakes your computer from the sleep. Let’s consider an example for simplification, following command will suspends computer to RAM and wakes it after two minutes and then it will launch the Firefox:

                         rtcwake -m mem -s 120 && Firefox


Following are few cases if you fall under one of these the above methods, unfortunately, may not work for you.

So guys these are the methods you can employ for making your Linux sleep and wake automatically. Follow them step by step to get effective results.