Light-Hearted Holiday Season Post #4

In this time of chaos, tumult, and constant change, I’ve decided that a little light-hearted Holiday Season levity is in order.  With that in mind, during this week of Christmas I’m posting a small series of somewhat strange and superfluous oddities for your enjoyment, until I come back to the regular posting schedule in 2011.  Enjoy…  And Happy Holidays…

Sub-Title:  The Mother-In-Law Script

Recently, my mother-in-law had some sort of a massive Windows-PC failure.  I’m not sure what was wrong with it, but instead of trying to fix it, she decided she wanted to replace it with a borrowed PC that was lying around my house (on loan from another family friend).  She worked out the finances with the owner, and went along her way.

The interesting part here is that I had installed Opensuse 11.3 on this new-to-her PC, and she was fine with that.  All she needed was a browser, really, and Firefox was already there…

Once at her house, she couldn’t access the Internet, and she called her ISP support.  Once she told them she was running Linux, they pretty much told her she was on her own.  😉

To make a long story short, I got her back up and running (even with her favorite Google Chrome browser), but I soon realized I would probably need to be able to reach her new computer in the future to assist as she needed… …So I wrote this little script (below), and dropped it onto her user “Desktop”.

This script, when run, basically re-names itself to reflect the DHCP address that the PC got from the ISP, and emails me the info as well.  This way, Mother-In-law can see the IP address for herself without knowing any custom commands, and I get notified of the address (if the email can get through).  If the machine is not properly networked, etc., then it obviously can’t email me, but the script name would at least reflect that, and she could tell me so.

So here it is.  Just copy the contents into a text file (this example is named “CheckAddress-64.299.2.23.sh”), change owner to the local user (“m-i-l” in my case), and flag as executable…  Enjoy!


#/bin/bash
MYFILE="$0"
MYADDR=`/sbin/ifconfig eth0 | grep "inet addr" | tr ":" " " | awk '{ print $3 }'`
NEWFILE="/home/m-i-l/Desktop/CheckAddress-$MYADDR".sh
mv $MYFILE $NEWFILE
mailx -s "Grandma is at $MYADDR" jpavlov@yourlinuxguy.com << EOF
Here you go:
Old name = $MYFILE
New name = $NEWFILE
EOF

Leave a Comment

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