2011-12-27

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.

Why Bother?

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.

The Fix

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:

  1. 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?

  2. 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:

    #!/bin/sh
    sap /storage/opt/shutdown.ogg &
    shutdown -h now &
    
  3. 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:

    PWRF)   logger "PowerButton pressed: $2" ;;

    and replace it with this line

    PWRF)   logger "PowerButton pressed: $2" && wind_shutdown;;
  4. Rejoice!

That's all for now. From me and my text editor, I wish you all a very hacky New Year. Now quit reading, and go shut something off.

Comments
Name:
not required
Email:
not required (will not be displayed)
Website:
not required (will link your name to your site)
Comment:
required
Please do not post HTML code or bbcode unless you want it to show up as code in your post. (or if you are a blog spammer, in which case, you probably aren't reading this anyway).
Prove you are human by solving a math problem! I'm sorry, but due to an increase of blog spam, I've had to implement a CAPTCHA.
Problem:
6 minus 6
Answer:
required
subscribe
 
2016
2015
2014
2013
2012
2011
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008