#!/bin/bash

timer="$1"
shift

"$@"
exitcode=$?

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
