From 0841de1c733189f7e8e4edb46552ad1629fa129b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 12 Oct 2017 18:42:23 +0100 Subject: [PATCH] probes: logfile for easy viewing --- crontab.part.INO | 1 + probes/modrelays-probe | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/crontab.part.INO b/crontab.part.INO index dc6fa01..82724bd 100644 --- a/crontab.part.INO +++ b/crontab.part.INO @@ -6,6 +6,7 @@ 50 7 * * 1 savelog -p live-%ABBREV%/xlog/log/%GROUP%/event.log 51 7 12 * * savelog -p live-%ABBREV%/errs 52 7 12 * * savelog -p live-%ABBREV%/webstump/log/webstump.log +52 7 12 * * savelog -p live-%ABBREV%/probes/log/log 53 7 * * 1 find live-%ABBREV%/xlog/log/%GROUP%/public -mtime +14 -type f -print0 | xargs -r0 rm -- 51 * * * * cd %BASEDIR% && probes/modrelays-probe all 3-59/5 * * * * cd %BASEDIR% && probes/modrelays-probe report diff --git a/probes/modrelays-probe b/probes/modrelays-probe index 80109e2..28db476 100755 --- a/probes/modrelays-probe +++ b/probes/modrelays-probe @@ -21,6 +21,7 @@ esac id=$(date +%s)_$$ statedir=probes/probes +logdir=probes/log lockfile=$statedir/.lock fail () { @@ -226,6 +227,10 @@ acquire_lock () { do-report-log () { # implicitly uses $outcome, $reported etc. - see maybe-report + mkdir -p $logdir + printf >>$logdir/log "%s: %s%s %s (%s)\n" \ + "$(date --iso-8601=seconds | sed 's/T/ /')" \ + "$outcome" "${reported:+ previously=}$reported" "$info" "$message" echo "$outcome" >"$attempt"/reported } -- 2.30.2