Warning

This information is outdated Go to this page for some detailed instructions

Linux ACPI wakeup tool

The ACPI wakeup tool is a little commandline application that allows your linux computer to wakeup from soft-off (S5) at a predetermined time.

If you want to have a server turn off at night but poweron it selfs in the morning you would have to set this manually each and every day, writing a shell script is possible but handling dates is a pain on the shell. Hence I wrote this tool to be a quick way to set the ACPI wakeup time.

It was tested on an ASUS A78N8X LA, this is a nForce2 chipset manufactered by Asus for HP. However this should work on many different motherboards.

Install this application and add it to your shutdown scripts. That way when the computer gets shutdown this tool set the next wakeup time into the BIOS.

Download

Wakeup 1.0 (August 13th, 2006), this includes the source and a precompiled binary for Ubuntu 6

Installation

  • Place wakeup in /usr/sbin
  • Create a file in init.d called wakeup with the following content:
    #!/bin/bash
    #
    
    OPTIONS="7:30:00"
    
    . /lib/lsb/init-functions
    
    if [ "$1" = "start" -o "$1" = "restart" ]; then
            log_begin_msg "Setting RTC Wake time"
            /usr/sbin/wakeup $OPTIONS
            log_end_msg $?
            exit
    fi
    
    if [ "$1" = "stop" ]; then
            log_begin_msg "Setting RTC Wake time"
            /usr/sbin/wakeup $OPTIONS
            log_end_msg $?
            exit
    fi
    
    echo "Unrecognised option \"$1\""
    exit
  • Modify the wakeup time to your liking
  • Symlink from the runlevel that you are using, for me that was runlevel 2
    ln /etc/init.d/wakeup /etc/rc2.d/S71wakeup -s
That's it. You PC should now automatically start every day at 7.30. if you also need an automatic shutdown, use crontab to do that. Here is the script I use for that called 'endofday'
#!/bin/bash

echo "System preparing for midnight shutdown" | wall

w=`smbstatus -p | wc -l`
while [ $w -gt 4 ]; do
        sleep 60
        w=`smbstatus -p | wc -l`
done

w=`who | wc -l`
while [ $w -gt 0 ]; do
        sleep 60
        w=`who | wc -l`
done

shutdown -h now
This line goes into /etc/crontab:
30 23 * * * root /etc/endofday &
Basically this is a smb server, so unless someone is logged in this will shutdown the server. By killing this script you prevent it from shutting down while you are logged in.

Copyright

This software is BSD licensed.