#!/bin/csh -f # Is Kevin still at work? # # kpi - 04/20/07 # # All this so my wife can know if I have left work yet. # # Ahh technology savior of relationships. # # This all assumes you have a static DHCP lease and that DNS points to this # lease. If you don't have a DNS setup then use IP. # # 2008-06/30 I added logic to make sure I am at my cubical's subnet # as I was getting false postives when I VPN'ed in. # # Globals set laptop="mylaptop.somewhere.us" set work_subnet="10.1.27" set aprs="http://www.findu.com/cgi-bin/inputpos.cgi?call=k4zxy-3&passwd=somepassword&lat=28.32456&lon=-081.12345" set dummy="/home/kevin/tmp/at_work.tmp" set msg="/home/kevin/tmp/at_work_msg.tmp" set dat="/home/kinscoe/pers/atworkstatus.dat" set arrival_log="/home/kinscoe/logs/arrival_log.log" # Announce ourselves echo "$0 starting at `/bin/date`..." /bin/date > $dummy /usr/bin/id # Ping the laptop to see if I am docked /bin/ping -c1 $laptop set result=$status echo "result=$result" set found_subnet=`/usr/bin/host mylaptop.somewhere.us | /bin/awk '{ print $4 }' | /bin/awk -F. '{ print $1 "." $2 "." $3 }'` echo "found=$found_subnet cubical subnet=$work_subnet" if ( "$result" == "0" ) then if ( "$found_subnet" == "$work_subnet") then echo "He's still at work." echo "