diff options
Diffstat (limited to 'monitor.sh')
| -rwxr-xr-x | monitor.sh | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -15,18 +15,15 @@ else newfile=1 fi -# echo "datafile = $datafile" - ip=$(curl ifconfig.me/ip) -[ ${#ip} = 0 ] && ip="Timed out" -# Could also do [ -z $ip ] +[ ${#ip} = 0 ] && exit 1 # Could also do [ -z $ip ] dt=$(\date +%Y-%m-%dT%T%:z) # either write date + IP to new file or compare IPs # write date and IP address to file but delete if it's a dud if (test "$newfile" -eq 1) then echo -e "$dt\t$ip" > $datafile - [ "$ip" == "Timed out" ] && rm $datafile + # [ "$ip" == "Timed out" ] && rm $datafile else # datafile already exists, so compare read line < $datafile |
