Damn it’s cold!

monkeybashOk, I am getting this post in just under the wire. To be honest I don’t know where all my time has been going lately. I feel like someone has been “flashy thing me” from Men In Black. On Wednesdays I’ve been taking German lessons and every week it comes to Tuesday and I try to figure out where all the time went and why I had so little time to study. I think it’s just the perspective of time as one becomes older. When you were five, summer lasted forever. Now summer seems like a month. A week seems like 3 days and a year feels like 6 months. Maybe I am just growing older in dog years now.

I was going to post about some re-travel I did, but I’m now subbing it out for todays work issue. This morning I get a call advising me that that the power is out. I figured I would just hangout at home and watch some DVRed Daily Show episodes until the power came back on. Being the company go to nerd, I would have to be one of the first ones in the building to deal with all the odd problems that come up with a power outage. If was 67F yesterday and today it’s 23F. So my desire to drive back and forth to check if the power was back on was not there because it’s damn cold out.

In order to know when the power came back online, I went to my friend Linux. I created a quick bash script to ping an IP address on the Internet every 5 seconds for 1 ping. If the ping came back with a reply, I would receive an alarm. In this case, the alarm was an MP3 file played through VLC.  For the IP host address I used the outside of the firewall. So when the power is restored, the UPS starts up the firewall. When the firewall is loaded and ready, it connect back to the Internet.

Here the code:

#!/bin/bash
# ping alarm and scheduler. Will ping an IP every 5 seconds until the IP is online. Once the IP is online, it will play and MP3 to alarm the user.

x=”0″
while [ $x -lt 1 ]
do

server=${1}
musicfile=${2}
### HELP INFORMATION
echo “Pinging host: “${server}
help=”Correct syntax:  pinger.sh {ip_address} {path_and_file_of_mp3}”

if [ -z $server ];then echo ${help};exit 2;fi
if [ ${server} = “–help” ];then echo ${help};exit 2;fi

function1 (){
ping -c 1 ${server} |grep received |awk -F’ ‘ ‘ {print $4}’
}

x=`function1`

echo ${x} “Replies from server :” ${server}

sleep 5
done

vlc ${musicfile}

 

So about 45mins later, I started to hear a very loud (speakers were way up) “Private Idaho” by the B-52s. So it was time to go to work.

This entry was posted in Mediocre fun, Obsess and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.