I want to schedule power off at 23:30 and power on at 6:30 everyday.

Here are some problems:

  1. If I run such command sudo rtcwake -m off -l -t $(date +%s -d 'tomorrow 06:30') it switches off the pc but does not switch on at 06:30 as expected.

However when I run this command sudo rtcwake -m off -s 120 it works as expected - the pc is powered off then powered on in 120 sec automatically

  1. I have scheduled such task 30 23 * * * rtcwake -m off -l -t $(date +\%s -d 'tomorrow 06:30') (using sudo crontab -e) but the pc is not powered at 23:30 as expected

Can you help me with these two problems?


  • For your second command in the crontab, you need to have the full path to the command /usr/sbin/rtcwake. – Terrance Jan 14 '16 at 14:41
  • 7 hours are 25200 seconds. Couldn't you just schedule sudo rtcwake -m off -s 25200 at 23:30 in the crontab? (Disclaimer: I never did it, and I hope that rtcwake -m off takes care of shutting down the computer nicely). – Rmano Jan 14 '16 at 14:42
  • When your computer is OFF, what do you think can run to turn it ON? I seem to recall seeing a "turn on time" setting in some of the BIOSes I've encountered. YMMV. – waltinator Jan 14 '16 at 15:01
  • 1
    waltinator: The Real Time Clock (RTC) wakealarm mechanism will automatically wake the machine. The wake up time is programmed in the Real Time Clock and this battery backed device will trigger the processor to wakeup when the event occurs. Thus the machine can be powered off for this to work. – Colin Ian King Jan 14 '16 at 16:05
  • Terrance: Yes, specifying full path /usr/sbin/rtcwake works for me, thanks Rmano: The solution with specifying explicit time would be more convenient. I know I can create a script to calculate amount of seconds basing on exact time but for new I leave it with -s option as you suggested for simplicity, thanks – Solvek Jan 15 '16 at 7:51
  1. The first problem I decided to solve by specifying amount of seconds for wake up time instead of explicit time.
  2. The second problem can be solved by specifying full path to the rtcwake.

30 23 * * * /usr/sbin/rtcwake -m off -s 25200

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.