In order to get the volume to increase gradually from the command line, you need to install aumix. If you don't have mplayer installed, then install it as well unless you wish to use something else.
sudo apt-get install aumix mplayer
Next, create a script /usr/local/bin/wakeup-volume to increase the volume over time. Amend the sleep intervals and increments of I to suit.
/usr/bin/aumix -v$I -p100 -w100
Then create a script /usr/local/bin/alarm-clock and select your command line and music file you wish to wake up to. I am using mplayer and looping the music file five times in this example.
This script kills all wakeup-volume processes and starts a new wakeup-volume process before playing your tune of choice.
#!/bin/bashLast of all, set up crontab to wake you up. I have set mine to wake me up at 06:59 Monday to Friday.
SONG="$HOME/Music/alarm clock song.ogg"
$PLAYER -loop 5 "$SONG"
59 6 * * 1-5 /usr/bin/X11/xterm -display :0 \Note: crontab expects the above to be on one line. I have put a continuation escape character in because I don't have enough width on this here blog.
-bg black -fg green -e /usr/local/bin/alarm-clock
Don't forget to set execute rights on the two scripts...
sudo chmod 755 /usr/local/bin/alarm-clock
sudo chmod 755 /usr/local/bin/wakeup-volume
Alarm clock in action