Pretty neat trick by Craig Perry at http://ubuntuforums.org/showthread.php?t=462960. The following is pretty much word-for-word reposted. Since I have an old 400mhz Pentium 2 under my desk that I use as a Tomcat development box. I also find it useful to use it as a development platform that gives immediate feedback of suboptimal code, and it's always a nice surprise to find scripts and pages that take 10-20 seconds to run on it take less than a half-second on any other machine.

Install beep

sudo apt-get install beep

Create the following at /etc/init.d/beep

#!/bin/bash
#
# beep
# Notify when the system is up, or going down
# Craig Perry, 4th Jun 2007

BEEP=/usr/bin/beep
. /lib/lsb/init-functions

case "$1" in
  start)
    log_begin_msg "Audible notification - System Now Up..."
    for i in `seq 750 50 1500`; do
      $BEEP -l 50 -f $i
    done
    log_end_msg 0
    ;;
  stop)
    log_begin_msg "Audible notification - System Going Down..."
    for i in `seq 1500 -50 750`; do
      $BEEP -l 50 -f $i
    done
    log_end_msg 0
    ;;
  *)
    log_success_msg "Usage: $0 {start|stop}"
    exit 1
    ;;
esac
exit 0

Then make it executable:

chmod +x /etc/init.d/beep

Finally, tell the system to add hooks to run it last (99) on startup and first (01) on shutdown:

sudo update-rc.d beep defaults 99 01

This gives you an ascending tone when the system comes up, and a descending tone as it's starting to shutdown (i.e. confirms you've pressed the power button correctly).