chiark / gitweb /
probes: Break out do-report-log
[modbot-mtm.git] / probes / modrelays-probe
index 22f00a718413f96eef809b89a6a0ef35981cb6b5..521a0403859efe1ac48e2c91722cf18fba80730a 100755 (executable)
@@ -224,6 +224,11 @@ acquire_lock () {
        exec with-lock-ex $lock_mode "$lockfile" "$0" "$mode" "$@"
 }
 
+do-report-log () {
+       # implicitly uses $outcome, $reported etc. - see maybe-report
+       echo "$outcome" >"$attempt"/reported
+}
+
 maybe-report () {
        local outcome=$1
 
@@ -240,7 +245,7 @@ maybe-report () {
        if [ "x$outcome" = "x$reported" ]; then return; fi
 
        if [ x"$outcome" = x"ok" ] && [ x"$reported" = x ]; then
-               echo ok >"$attempt/reported"
+               do-report-log
                return
        fi
 
@@ -320,7 +325,7 @@ END
 END
 
        /usr/sbin/sendmail -odb -oem -oee -t <"$email"
-       echo "$outcome" >"$attempt"/reported
+       do-report-log
 }
 
 mode_report () {