Beep on startup and shutdown

I seem to like getting my machines to make beeping noises!

Not content with getting my server to beep on startup I decided to see if I could get it to beep on both start-up and shutdown. It is actually quite useful particularly on my servers as it provides an audible confirmation of what is going on.

Of course you can also use this method to run all sorts of other commands when your system starts up or shuts down – and the output is echoed to the console…

First you need to install the beep utility if not already installed. Open a terminal window or login on the console and enter the following commands.

$ sudo apt-get update
Get:1 lenny/updates Release [92.4kB]
Fetched 7,505 kB in 47s (159 kB/s)
Reading package lists... Done
$ sudo apt-get install beep
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 23.6kB of archives.
Setting up beep (1.2.2-22) ...

To actually get the machine to emit a rising tone when it starts up and a descending tone when it shuts down you need to create a short script to handle the start and stop events from rc.d.

$ sudo vi /etc/init.d/beep

#! /bin/sh -e
# Provides:          beep
# Required-Start:    $syslog
# Required-Stop:     $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: beep
# Description:

# Carry out specific functions (start, stop, restart etc)
case "$1" in
    beep -l 75 -f 500 -n -l 75 -f 1000 -n -l 75 -f 2000 -n -l 75 -f 3000
    beep -l 75 -f 3000 -n -l 75 -f 2000 -n -l 75 -f 1000 -n -l 75 -f 500
    echo "Usage: /etc/init.d/beep {start|stop}"
    exit 1

exit 0

To get rc.d to invoke the beep stript when the system starts and stops use the following command.

$ sudo chmod a+x /etc/init.d/beep
$ sudo update-rc.d  beep defaults 01

To disable it.

$ sudo update-rc.d beep remove

If anyone can tell me how to get the beeps to happen later on (preferably as close to last as possible) in both the startup and shutdown sequence I’d like to know. I’ve tried substituting different values for the 01 in the command above but it does not seem to make any difference.

This entry was posted in Debian, Linux, Raspbian, Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s