summaryrefslogtreecommitdiff
path: root/monitor.sh
diff options
context:
space:
mode:
authorF3RR3T <github@st33v.com>2014-08-24 14:26:51 +1000
committerF3RR3T <github@st33v.com>2014-08-24 14:26:51 +1000
commit064edd67e0535f01a98282505e34ce02eb03befa (patch)
tree1a11a016c7c55421c4e18a5ce49cf158af59b2dd /monitor.sh
parent1ed1f885f7dce63b62289260ad4fd48679c60e98 (diff)
Interim stage.
Monitor script logs every 30 mins. compare.sh has some test file reading and comparison functions But the time has come to wrap it all into one script. This will be called monitor.sh
Diffstat (limited to 'monitor.sh')
-rwxr-xr-xmonitor.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/monitor.sh b/monitor.sh
index e902c86..bebc07c 100755
--- a/monitor.sh
+++ b/monitor.sh
@@ -1,4 +1,4 @@
-#! /bin/sh -
+#! /bin/bash -
# SJP 16 August 2014
# Monitor my external IP address
@@ -13,11 +13,15 @@ else
datafile=`mktemp --tmpdir=data`
fi
-echo "datafile = $datafile"
+# echo "datafile = $datafile"
ip=$(curl ifconfig.me/ip)
+[ ${#ip} = 0 ] && ip="Timed out"
+# Could also do [ -z $ip ]
+
dt=$(\date +%Y-%m-%dT%T%:z)
+
echo -e "$dt\t$ip" >> $datafile