2022-02-06 12:42:08 +00:00
|
|
|
#!/bin/bash
|
2022-02-06 12:39:52 +00:00
|
|
|
|
|
|
|
if [[ -z "$1" ]]
|
|
|
|
then
|
|
|
|
echo "Usage: $0 <timer>"
|
|
|
|
exit 3
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! [[ -f "/var/lib/systemd-timer-monitored/$1" ]]
|
|
|
|
then
|
2022-09-11 09:26:57 +00:00
|
|
|
echo "Everything is fine"
|
|
|
|
exit 0
|
2022-02-06 12:39:52 +00:00
|
|
|
fi
|
|
|
|
|
2022-09-11 09:26:57 +00:00
|
|
|
date="$(date --date="@$(cat "/var/lib/systemd-timer-monitored/$1")" "+%F %T %z")"
|
2022-02-06 12:39:52 +00:00
|
|
|
|
2022-09-11 09:26:57 +00:00
|
|
|
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
|