How to enable a startup & shutdown sound on Linux Servers

March 1st, 2008 Categories: HOWTO's


I was looking for a way to get notifications when servers start up or shutdown. Since a server normally doesn’t have a monitor connected.

Using a chime / tone could be very effective, but since servers normally don’t have external speakers, the internal speaker would need to be used. It is there already, and generally used by the BIOS for diagnosis.

The following website, http://www.johnath.com/beep/ has a nice script for this exact purpose. Setting is up is very easy, If you use an rpm based system like Fedora Core, CentOS, Redhat, etc, then you can use rpm to install the script, as follows:

[php]

rpm -ivh http://www.johnath.com/beep/beep-1.2.2-1.src.rpm
[/php]

Once installed, you need to reboot for the script to take affect, since it’s using the internal speaker. After you have rebooted, you can use it with

[php]
/usr/bin/beep -l 75 -f 500
[/php]

use man beep to see all the options.

ipcop use the following startup & shutdown "sequences":

[shell]

# Send nice startup beep now
/usr/bin/beep -l 75 -f 500
/usr/bin/beep -l 75 -f 1000
/usr/bin/beep -l 75 -f 2000
/usr/bin/beep -l 75 -f 3000

# Send nice shutdown beep now
/usr/bin/beep -l 75 -f 3000
/usr/bin/beep -l 75 -f 2000
/usr/bin/beep -l 75 -f 1000
/usr/bin/beep -l 75 -f 500
[/shell]

To make this work automatically when the server starts up, or shuts down, you need to create the following 2 scripts (or similar), in /scripts ( I keep al my "self made" scripts here, you can put it anywhere you like)

Create the startup sound with "vi /scripts/startupsound"

[php]

/usr/bin/beep -l 125 -f 500
/usr/bin/beep -l 125 -f 1000
/usr/bin/beep -l 125 -f 2000
/usr/bin/beep -l 125 -f 3000
/usr/bin/beep -l 125 -f 4000
/usr/bin/beep -l 125 -f 5000
[/php]

Now, create the shutdown file, with "vi /scripts/shutdownsound"
[php]
/usr/bin/beep -l 125 -f 5000
/usr/bin/beep -l 125 -f 4000
/usr/bin/beep -l 125 -f 3000
/usr/bin/beep -l 125 -f 2000
/usr/bin/beep -l 125 -f 1000
/usr/bin/beep -l 125 -f 500
[/php]

Lastly, we need make them executable, as follows:
[php]
chmod +x /scripts/startupsound
chmod +x /script/shutdownsound
[/php]

and then add them to the system runtime scripts. For startup, add the following right at the bottom of /etc/rc.local:

[php]
sh /script/startupsound
[/php]

The shutdown sound script goes into /etc/init.d/halt, at the top:

[php]
sh /script/shutdownsound
[/php]

Tags:
No comments yet.
You must be logged in to post a comment.