25 May 2013

Saurav Modak's picture
Posted by Saurav Modak on August 13, 2012

So your unlimited download time starts at  2 AM and you are feeling too sleepy to wake up at that time. You have a PC running Linux, and like all lazy human beings, you feel that its task of a computer to do things automated by himself. Thankfully there is a way, so that you can suspend your PC and turn it on at a specified time.

rtcwake is a utility with the help of which you can turn off/suspend your PC now and tell it automatically to turn on itself/wake up at a specified time. This is especially useful if you have to do some task later and you would like to save power till then. The basic usage of the command is:

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

eg, if you would like to hibernate and wake the computer after 60 seconds automatically.

sudo rtcwake -m disk -s 60

The description of type of suspend is given below:

The -m switch accepts the following types of suspend:

  • standby – little power savings but quick restorations
  • mem – Suspend to RAM. Low power used
  • disk – Suspend to disk. No power used as the PC is in switched off state
  • off – Turn the computer off completely. This doesn't work (yet).
  • no – set the wake up time. In the above options, the computer sleeps immediately, but in this one, you have to manually let it sleep

Apart for number of seconds using -s, you can also specify

  • -t  To wake your PC at a time specified by number of seconds since UTC epoch.
  • -l  wake up at specified local time
  • -u wake up at specified UTC time

Try yourselves and let us know your experiences.

Tags: 

Saurav Modak

Saurav Modak is an engineering student and FOSS enthusiast who believes that best things in the world, such as software should be free (as in freedom). He is a hard core Arch fan and loves to show off his customized Arch Linux installation to friends. You can connect with Saurav on Facebook, Google+ and Twitter.