Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Some BIOSes have an option to start the computer from a fully off state (not suspended) at a specific 'alarm' time. Is there any command or way to set this in Ubuntu without restarting and going to the BIOS?

(I have a server+router running for a school network and sometimes some random (well intentioned) people think it needs to be off at the end of the school day. I figure the best way to avoid getting calls at random times that the network quit working is to have a cron job every minute that sets the 'alarm wake' time as 2 minutes from now. That way it would auto start itself.)

share|improve this question
up vote 7 down vote accepted

An operating system itself cannot bring hardware out of a completely-off state, as the OS is not running at that time. If there was any OS-level software to write to your BIOS, it would be proprietary software specific to the BIOS and motherboard etc., and highly unlikely to exist as an ubuntu command. Sorry.

BIOS options such as Wake On Lan, or your auto-start feature are one option. The other is a hardware solution similar to what some tv tuner cards do by getting hard wired into the power button in order to trigger power-on events. In cases like this, cron job could be used to constantly update the wake-time for the tuner card.

share|improve this answer
Thanks for the answer. I'm not sure if it is a good idea to check mark this answer. It seems like the best answer to this question, but if I mark it will people actually think there is a way to do this? – Azendale Jun 10 '11 at 21:21

Easy. First you need to check if your computer supports wakup on RTC. Most computers created in the last 10 years support this feature. First you need to enable RTC in BIOS settings, this is done in the boot process. On my BIOS it's possible to configure what S-signals the wakeup should respond to. Because I like to save energy I completly let my computer power down in between automatic startups and shutdowns.

After BIOS is setup, boot up Linux and issue command dmesg |grep rtc. This tells you if you have RTC wakeup enabled. My output gives:

~$ dmesg |grep rtc
[    0.962976] rtc_cmos 00:03: RTC can wake from S4
[    0.963096] rtc_cmos 00:03: rtc core: registered rtc_cmos as rtc0
[    0.963119] rtc0: alarms up to one month, 242 bytes nvram

To set the wakeup time you need to be root. As root issue command:

echo 0 > /sys/class/rtc/rtc0/wakealarm

The above command should be used before you write a new wakeup time to the file, otherwise the wakeup resource will be buisy. If you want your computer to start up in 10 minutes in the future issue command:

echo `date '+%s' -d '+ 10 minutes'` > /sys/class/rtc/rtc0/wakealarm

Check if alarm is set by issuing cat /sys/class/rtc/rtc0/wakealarm. If you get a bunch of digits it means that the alarm is set and if the file is empty there was something wrong with the date.

To check a more human readable format issue command cat /proc/driver/rtc.

So, if you want your computer to start 2 minutes after someone turns it off, execute a script that looks something like this from your crontab(this script will require root access, so be aware):

echo 0 > /sys/class/rtc/rtc0/wakealarm
echo `date '+%s' -d '+ 2 minutes'` > /sys/class/rtc/rtc0/wakealarm

Save the planet. :)

share|improve this answer

There should be a way to do this... I know I've seen it work on an MSI motherboard in Windows. One of MSI's programs was able to set the wake-on-timer state/time in the BIOS from Windows. What's probably needed is just the right BIOS calls to do this. I looked around once and couldn't find anything, but I didn't look too hard. I'll try looking again and post here if I find them. I'm betting that a tool to do this could be very universal, unlike what drgrog believes, because most motherboard vendors are getting their BIOSes from one of two vendors and few do any extensive modifications to them.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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