On my home network, when various things happen, a command is sent to Wind(my media playing machine) via some networked text to speech scripts. Since espeak is already installed on Wind, I thought I would use some 'text to speech' to notify me when Wind is shutting down. Egads! what a bad idea.
If you have espeak installed on your machine, fire up the command line and enter:
espeak "shutting down"
Would you really want to hear that every time a machine is shut down? Well you might, but I certainly don't.
When I first built Wind, I used two switches wired in parallel for the power on/off. This requires both switches to be depressed at the same time in order to turn the machine on or off. While this makes it very easy to avoid accidental shutdown, the switches I used give no tactile feedback and I can't always be sure that the machine has been shutdown, unless I stand around for a bit and wait for the computer light to power off. What a waste of my time.
I just want to hit the power and head out the door.
For reasons of maintaining sanity, I felt a simple audio file should be played when the machine is powered off. The process went something like this:
Make an Audio File
Using audacity and my cheap USB microphone, I recorded an overlapped descending 3 note arpeggio that I played on my concertina. After a bit of adjustment, it sounds like this:
Note: The shutdown audio file uses the non-patent encumbered ogg format. If your browser does not support playing ogg files, you owe it to yourself and the internet to file a bug report with your browser's creator regarding the lack of ogg support. Why do they hate the internet?
Make a Shutdown Script
part of the plan requires a very simple script that will play the audio file and then send the computer the shutdown command. On Wind, I created a script at /usr/local/sbin/wind_shutdown with the following code:
sap /storage/opt/shutdown.ogg &
shutdown -h now &
Run the Shutdown Script When the Power Button is Pressed
Wind is running Arch Linux with acpi, so I need to modify /etc/acpi/event.sh to run wind_shutdown when the power button pressed. Basically, I need to find this line: