20

I know that there are many ways to auto-shutdown, but I'm concerned about auto turn-on. Is there a command or a small piece of software to turn on the system at given time?

  • 3
    Automatically booting your PC is a BIOS feature, not an OS feature. What's the make and model of your motherboard? – Nzall Feb 19 '15 at 12:32
27

One alternative is to not shutdown, but to hibernate or suspend the system and then automatically wake it up using rtcwake utility.

For example

rtcwake -s 3600 -m disk

will immediately hibernate (suspend to disk) the system and resume it in 1 hour. Similarly

sleep 600; rtcwake -s 60 -m mem

will suspend to ram in 10 minutes from now, and then resume after 60 seconds.

You can also wake up the system at given time with -t option. It takes seconds since 1970 as an argument, but you can use date to convert from human readable format, e.g.

rtcwake -m disk -t "$(date -d '2015-02-26 16:12:00' '+%s')"
16

Check out the Wake-on-LAN (WoL) feature. Arch Linux has nice documentation on using it, and do not worry; it is Linux general. In Ubuntu you have the wakeonlan package to send magic packets to your machine. Here is Ubuntu documentation on using WoL.

So to turn your machine automatically, you will have to use another machine that will turn it on with WoL.

  • Can I install it on ubuntu 12.04 – remas sido Feb 18 '15 at 12:42
  • Wake on Lan only works well if you shut down properly. if you get a power outage or something. WOL will fail. BIOS scheduling will work every time. Look in your BIOS. – j0h Feb 18 '15 at 12:57
  • WOL requires another machine to send the packet, so rtcwake is the better solution here. Here's a duplicate question on AskUbuntu: askubuntu.com/questions/61708/…. – ryanmjacobs Feb 18 '15 at 17:01
  • It does require a second machine but it doesn't have to be a computer. You can send magic packets from an android (and presumably iOS?) phone/tablet. – Holloway Feb 19 '15 at 9:18
  • @Trengot: yes. You can send Wake-on-LAN messages from iOS device. – jfs Feb 19 '15 at 12:30
4

As far as I know, automatic boot is a feature that has to be provided and set up in your BIOS or UEFI and is independent from the OS (like Ubuntu) installed.

Look at the manual of your BIOS/UEFI or mainboard.

  • I'm using Dell Inspiron 1545, can it be configured? – remas sido Feb 18 '15 at 12:45
  • 2
    I don't know and I will not do a long research on this, as you are also able to google. Usually yes, unless it is a very old/ancient machine. But you always need a trigger. This can be either a specified time (not available on every machine), a signal from LAN (wake-on-LAN function as described in other answers), switching on the AC power, a keyboard/mouse event, etc... You have to think of how you want to start it and then check whether your BIOS/UEFI/mainboard/device supports this. Google is your friend! – Byte Commander Feb 18 '15 at 12:57
  • Actually, I find out that it support wake on lan option in power management in the BIOS menu – remas sido Feb 18 '15 at 13:38
  • @remassido You may need to enable wake-on-clock in your BIOS, but after that, you should be able to configure an actual wake-up time with a tool like rtcwake. – Gilles 'SO- stop being evil' Feb 19 '15 at 0:38
3

It depends on whether the BIOS/UEFI of your computer supports this feature.

If it does, you can use the Ubuntu package nvram-wakeup to set the wakeup date/time.

Read the documentation of the package before using it (/usr/share/doc/nvram-wakeup/README.mb.gz) as it is possible that you need to do some work to configure the tool.

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.