# wanstatus: Monitor WideAreaNetwork status for disconnections
# After testing make this script a startup application
# sleep 5 minutes (300 seconds)to be sure internet connection is established
# set start name of wanstatus log (in Documents folder)
logfile=wanstatuslog-$(date +%Y%m%d)-$(date +%H%M%S)
echo "Wide Area Network status log to record disconnections by change of IP address." >> $logfile
echo "================================================= =============================" >> $logfile
# start loop here?
while [ 1 = 1 ]
# sleep 1 minute (60 seconds) before obtaining IP address again
sleep 1 # just sleep 1 second for test purposes
# assign dated value to variable logtime and put my public IP address alongside the time in the logfile
lineout="Date and Time: "
logtime=$(date +%Y%m%d)-$(date +%H%M%S) # date and time
ip=" IP address: "
lineout="$lineout $logtime $ip"
echo $lineout >> $logfile
curl ifconfig.me >> ipaddress
cat ipaddress >> $logfile
#next to do
# ? How do find out when IP address changes after an internet disconnect/reconnect ?