bundles/systemd-timers: don't auto-reset alerts
This commit is contained in:
parent
f004591e98
commit
d9be69d3a9
2 changed files with 15 additions and 14 deletions
|
@ -8,17 +8,13 @@ fi
|
||||||
|
|
||||||
if ! [[ -f "/var/lib/systemd-timer-monitored/$1" ]]
|
if ! [[ -f "/var/lib/systemd-timer-monitored/$1" ]]
|
||||||
then
|
then
|
||||||
echo "No status file found"
|
echo "Everything is fine"
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
|
|
||||||
exitcode="$(cat "/var/lib/systemd-timer-monitored/$1")"
|
|
||||||
|
|
||||||
echo "Last timer run exited $exitcode"
|
|
||||||
|
|
||||||
if [[ $exitcode -ne 0 ]]
|
|
||||||
then
|
|
||||||
exit 2
|
|
||||||
else
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
date="$(date --date="@$(cat "/var/lib/systemd-timer-monitored/$1")" "+%F %T %z")"
|
||||||
|
|
||||||
|
echo "Timer had an error during its run on $date"
|
||||||
|
echo
|
||||||
|
echo "Remove /var/lib/systemd-timer-monitored/$1 to clean this alert"
|
||||||
|
exit 2
|
||||||
|
|
|
@ -3,8 +3,13 @@
|
||||||
timer="$1"
|
timer="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
# Simple wrapper script that stores the exit code of a command into a file
|
|
||||||
"$@"
|
"$@"
|
||||||
exitcode=$?
|
exitcode=$?
|
||||||
|
|
||||||
echo "$exitcode" > "/var/lib/systemd-timer-monitored/$timer"
|
if [[ $exitcode -ne 0 ]]
|
||||||
|
then
|
||||||
|
echo "$(date -u +%s)" > "/var/lib/systemd-timer-monitored/$timer"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# to make systemd aware of the error, too.
|
||||||
|
exit $exitcode
|
||||||
|
|
Loading…
Reference in a new issue