aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2011-02-08 19:21:26 +0100
committerChristian Weiske <cweiske@cweiske.de>2011-02-08 19:21:26 +0100
commit5e1bb24194f6b8b12e99ca76bc62ca868a46a7f0 (patch)
tree4a9b7f41fc818e78d8a32c356a08d21d952927fd
parentc4da1837f58e4232471a5be78b75a6f6330ada22 (diff)
downloadusb-wde1-tools-5e1bb24194f6b8b12e99ca76bc62ca868a46a7f0.tar.gz
usb-wde1-tools-5e1bb24194f6b8b12e99ca76bc62ca868a46a7f0.zip
verify that the log timestamp is not too old
-rwxr-xr-xmunin/usb-wde1_10
1 files changed, 7 insertions, 3 deletions
diff --git a/munin/usb-wde1_ b/munin/usb-wde1_
index 9bd730f..950c6a7 100755
--- a/munin/usb-wde1_
+++ b/munin/usb-wde1_
@@ -107,19 +107,23 @@ fi
#split by semicolons
OLDIFS="$IFS"
IFS=";"
-read -r startzeichen zustand zeitstempel\
+read -r sign state timestamp\
t0 t1 t2 t3 t4 t5 t6 t7\
h0 h1 h2 h3 h4 h5 h6 h7\
tc hc ws ns rain checksum\
< "$logfile"
IFS=$OLDIFS
-if [ "$startzeichen" != '$1' ]; then
+if [ "$sign" != '$1' ]; then
echo Log line does not begin with \$1
exit 2
fi
-#FIXME: check timestamp
+curdate=`date +%s`
+if [ "$timestamp" -lt `expr $curdate - 600` ]; then
+ #timestamp is too old, data are too old
+ exit
+fi
if [ "$TYPE" = "temperature" ]; then