I have a backup.service called every hour by a backup.timer. Unfortunately the backup script running inside the container can complete successful but with warnings returning a non-zero exit code. So although everything may have worked, the container stops with a non-zero exitcode. So the unit enters failed state in fleet.
And in that case it seems, the timer won't start this unit again, altough I didn't find anything in the systemd docs saying that.
To make it clear: It's perfectly ok for me, to have the container stop with a non-zero exit code. But my timer then doesn't work.
I now could excapsulate that script into another which is then called als docker entrypoint. But I'll have to make sure that the output auf STDOUT and STDERR is somehow kept.
I also could run sudo systemctl reset-failed after the unit failed, but this seems to be a little hacky to me... (I tried that and in that case the timer ran the unit again. But it doesn't work as ExecStopPost-Task in the service file)
Is there any better way to make sure a that a unit
- doesn't enter failed state though it's returning non-zero, or
- reset it's state afterwards, or
- tell the timer to run that unit altough its status is failed?