Wake up alarm on Linux.
--- Ubuntu 9.10
I wanted to put the computer on standby when I go bed and wake up with music in the morning.
I read about plugins for xmms, amarok, python scripts, and bash scripts.
Some people were using the node .../.../wakealarm to set up the computer wake up time.
The best solution I found is to use rtcwake and alarm-clock. The first to resume the computer from standby. The second to run anything you want whenever you want.
Examples:
# sudo rtcwake --verbose --mode standby --time `date +%s --date "2011-01-11 07:30"`
# sudo rtcwake --verbose --mode standby --time `date +%s --date "tomorrow 07:30"`
The rtcwake command is part of the util-linux-ng package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.
Then use alarm-clock program to run the task you want.
That worked fine in Ubuntu, but not on my Debian computer.
--- Debian
Since the rtcwake didn't work well on my Debian, I had to find another solution.
I also found out that better than having two tasks to wake up at different times was to leave the music playing when I put the computer to sleep. When it wakes up the music would simply continue.
So this is the process (line) to make the computer wake up (as root):
## ensure that the permissions are correct; clean up anything previous ; insert wake up time; go to sleep;
# chmod 666 /sys/class/rtc/rtc0/wakealarm ; echo 0 > /sys/class/rtc/rtc0/wakealarm; echo `date -d "tomorrow 6:56" +%s` > /sys/class/rtc/rtc0/wakealarm ; pm-suspend
I find (up arrow key) and enter it when I go bed, and in the morning, since I have the screen off, I just do the same process again (up + Enter) when leaving home. I just use the music for some minutes.
I also did an script to raise the volume and then set it to medium-high, but at the end I just set up the volume before running the line and forget about the script.
In any case, here it is:
==============================
#!/bin/bash
# ------- Tasks -----------------------------------
# start playing music
kaffeine --play /your/play/list &
# set and increase volume repeatedly
SLEEPX="4";
for i in $(seq 40 85); do echo $i; VV="$i%"; aumix -v $VV -l $VV -p $VV -w $VV -W $VV; sleep $SLEEPX ; done;
# change volume to something normal
sleep 10; VV="75%"; aumix -v $VV -l $VV -p $VV -w $VV -W $VV
==============================
Hope it helps to anyone looking to have less devices on the room, while saving energy/noise and having a pleasant wake up.