I would like to shutdown my system and boot it again after X seconds. Is there any command or service I can use to perform such task?

The purpose: I perform the shutdown when I have the suspect that the power supply is going to be unplugged, so, if it is the case the system will stay off (of course because there is no power) otherwise the system will start again.

  • 1
    Some PC BIOSes can be configured to boot at a given time. You could also try wake-on-LAN, but that also depends on your BIOS and your NIC. – Satō Katsura Oct 2 '16 at 20:08

You may be looking for rtcwake, which (at least on Debian) comes in package util-linux and makes use of your computer's real-time clock alarm. Just go into hibernation instead of shutting down (and try nvram-wakeup, if rtcwake won't work out of hibernating for you).

| improve this answer | |
  • The command nvram-wakeup -s $((`date +%s` + X)) seems the right thing to do here but I get an error message like "You mainboard is currently not supported" so I guess I have to try something else. Concerning rtcwake I don't know what happen if a cut the supply in hibernation mode. I may have to try. – lcit Oct 3 '16 at 14:43
  • I just tried the following command rtcwake -m off -s X and it works like a charm! The mode off is used to shutdown the system. It is not officially supported by ACPI, but usually works. – lcit Oct 3 '16 at 14:56

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.