summaryrefslogtreecommitdiff
path: root/monitor.sh
diff options
context:
space:
mode:
Diffstat (limited to 'monitor.sh')
-rwxr-xr-xmonitor.sh7
1 files changed, 2 insertions, 5 deletions
diff --git a/monitor.sh b/monitor.sh
index 1bf5129..2315915 100755
--- a/monitor.sh
+++ b/monitor.sh
@@ -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