+ if [ ! -e "$f" ]; then
+ msg="${msg}state file $f is missing or unreadable\n"
+ EXIT=2
+ failed="$f $failed"
+ elif [ -n "$ZEROFAIL" ] && ! [ -s "$f" ]; then
+ msg="${msg}state file $f is empty\n"
+ EXIT=2
+ failed="$f $failed"
+ elif [ "$(( $( date +%s ) - $(stat $FOLLOW -c %Y "$f") ))" -gt "$(( $INTERVAL * 60 ))" ]; then
+ msg="${msg}state file $f is older than $INTERVAL minutes (updated on $(stat $FOLLOW -c %y "$f"))\n"
+ EXIT=2
+ failed="$f $failed"
+ else
+ msg="${msg}state file $f OK: updated on $(stat $FOLLOW -c %y "$f")\n"
+ ok="$f $ok"
+ fi
+done
+
+if [ "$total" = 1 ]; then
+ echo -n $msg
+else
+ if [ -n "$failed" ]; then
+ echo -n "FAIL: $failed "
+ fi
+ if [ -n "$ok" ]; then
+ echo -n "OK: $ok "
+ fi
+ echo
+ echo -n $msg
+fi
+exit $EXIT