6

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.)

3 Answers 3

7

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.

0
6

Easy. First you need to check if your computer supports wake-up 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 wake-up should respond to. Because I like to save energy I completely 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 wake-up 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 wake-up time to the file, otherwise the wake-up resource will be busy. 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):

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

Save the planet. :)

1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .