Quote Originally Posted by inspiral View Post
my plan is to add the commands to the action file to put the box in suspend for a period then take it down to hibernate if not used for a further period.
FYI this is the sequence I'm thinking of:

  • zero wake alarm timer
  • set wake alarm timer
  • suspend
  • box will then either be awoken via button, keyboard , WOL or alarm
  • check if woken early
  • hibernate if false
  • exit script if true

This will only work if the 'action' script continues to run once awoken from suspend.

At mo I know how to do everything apart from check to see if the box is woken early but think this'll probably be possible by comparing the current time against the alarm time.

I'm going to extract the alarm relevant cmds from the following script:

http://people.canonical.com/%7Eapw/s...e/test-suspend

# Request wakeup from the RTC or ACPI alarm timers. Set the timeout
# at 'now' + $timeout seconds.
#
ctl='/sys/class/rtc/rtc0/wakealarm'
if [ -f "$ctl" ]; then
time=`date '+%s' -d "+ $timeout seconds"`
# Cancel any outstanding timers.
echo "0" >"$ctl"
# rtcN/wakealarm uses absolute time in seconds
echo "$time" >"$ctl"
return 0
fi
ctl='/proc/acpi/alarm'
if [ -f "$ctl" ]; then
echo `date '+%F %H:%M:%S' -d '+ '$timeout' seconds'` >"$ctl"
return 0

Thanks to the original authors

I'm going to test all this manually first, I'll post the results once done.