On 12/03/2008, David Reynolds <david@reynoldsfamily.org.uk> wrote:
Anyone else had any experience of making the ACPI alarm work?

I've got the alarm working on my Mini-ITX M10000.  I have a script called set_alarm.sh which I wrote which contains:

#/bin/bash

if [ "$1" = "--settime" ]; then
        # convert from seconds since epoc to string
        date_with_tz=$(awk "BEGIN {print strftime(\"%Y-%m-%d %H:%M:%S %Z\", $2)}")
else
        # gnu date can't handle the T
        gnu_friendly_date=$(echo $* | sed 's/T/ /')
        # add local timezone
        date_with_tz=$(date -d "$gnu_friendly_date")
fi
# hw clock is in UTC so convert date to UTC
hw_date=$(echo "$date_with_tz" | date -u -f - +%F\ %T)
echo "Setting wakeup time to $hw_date UTC"
echo "$hw_date" > /proc/acpi/alarm


You can run this like, "set_alarm.sh 11pm" to set the machine to wake up today at 11pm, or you can specify a full time and date.  Basically you can specify anything that the date program understands.
I also needed to change my shutdown scripts so that when then run hwclock to sync the OS time to the bios it saves and restores the alarm time.  e.g.:

ACPITIME=`cat /proc/acpi/alarm`
/sbin/hwclock --systohc
echo "$ACPITIME" > /procacpi/alarm

This is a known problem with my motherboard and now I've done that it all works for me and I'm using it to shut down my tv machine which runs mythtv and wake it up in time to start recording the next program.  I think I originally got the instructions from here http://www.mythtv.org/wiki/index.php/ACPI_Wakeup

HTH,

JD