From: Christian Weiske Date: Tue, 8 Feb 2011 18:21:26 +0000 (+0100) Subject: verify that the log timestamp is not too old X-Git-Tag: v1.0.0~25 X-Git-Url: https://git.cweiske.de/usb-wde1-tools.git/commitdiff_plain/5e1bb24194f6b8b12e99ca76bc62ca868a46a7f0 verify that the log timestamp is not too old --- 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