#!/bin/csh -f # # check wx alert page for activity # # written by Kevin P. Inscoe (inscoe@iag.net) (5/25/98) # # I use the Florida script here but ypou can change URL to your needs for # your state. Look at http://pocmtn.com/wxpgr.html to find your state. # # # # global variables # set URL = "http://iwin.nws.noaa.gov/iwin/fl/warnings.html" set PROXY_HOST = "cbisgate.cbis.com" set BROWSER_CMD = "/opt/bin/lynx -dump" set RCPT = "kevin.inscoe@cbis.com" @ SLEEP_INTERVAL = 10 * 60 # last hour of the day (24 hour) to run set lastrun = 23 @ lastsum = 0 # # Announce ourselves # /bin/echo $0 "starting at `/usr/bin/date`" top: # # check URL for updates # set DTMP = `/bin/date '+%H%M%S'` set TMP = /tmp/checkwx_$DTMP.tmp if ( -e $TMP ) /bin/rm -f $TMP (/bin/rsh $PROXY_HOST $BROWSER_CMD $URL) > $TMP /bin/grep -i "No Current Warnings" $TMP if ( $status != '0' ) then set xsum = `/bin/sum $TMP | /bin/cut -f1 -d' '` echo $xsum @ cksum = $xsum echo $cksum echo $lastsum if ( $cksum == 0 ) goto sleep if ( $lastsum == 0 ) goto skip_it if ( $cksum != $lastsum ) then skip_it: /bin/cat $TMP | /usr/ucb/mail -s "NWS update" $RCPT @ lastsum = $cksum endif endif /bin/rm -f $TMP sleep: # Check to see if we are still in our window... set hour = `/usr/bin/date '+%H'` if ( $hour < $lastrun ) then sleep $SLEEP_INTERVAL goto top endif # # our tour of duty is over..time to bail # /bin/echo "lastrun completed...exiting at `/usr/bin/date`" exit 0