Reset / Ingnore non-zero exit code with fleet / systemd
You could prefix your command with -
, then systemd ignores the failure and won't put the unit into a failed state. So, instead of
ExecStart=/path/to/your/command
Try
ExecStart=-/path/to/your/command
See systemd man page for more.
In case you want to ignore some return values, but still want some others to count to systemd as errors, you can specify them in the [Service]
section of your .service file as a space-separated list to SuccessExitStatus
, RestartPreventExitStatus
, and RestartForceExitStatus
. These also take signal names.
Reference: man 5 systemd.service