The systemd.service can be configured to restart a service based on a number of conditions. This systemctl man page has a good explanation of the reasons and reasons are included in this answer so this answer can stand alone.
The definition for Restart=on-abort
is the service will be restarted only if the service process exits due to an uncaught signal not specified as a clean exit status. This means a signal other than SIGHUP, SIGINT, SIGTERM or SIGPIPE. These 4 signals are described as clean signals by the systemctl man page.
In my case I actually wanted Restart=always
because regardless of how the process died or exited, I wanted it to be restarted. The property RestartSec=15s
is important for me because I want some time between restarts to prevent constently restarting (I don't expect this to happen but that is why I have this setting).
The following is take from the systemctl man page and formatted for SO:
Restart= values can be no
, on-success
, on-failure
, on-abnormal
, on-watchdog
,on-abort
, or always
.
Each of these values is explained next:
no (the default) - If set to no
the service will not be restarted.
success - If set to on-success
, it will be restarted only when the
service process exits cleanly. In this context, a clean exit means an
exit code of 0, or one of the signals SIGHUP, SIGINT, SIGTERM or
SIGPIPE, and additionally, exit statuses and signals specified in
SuccessExitStatus=.
on-failure - If set to on-failure
, the service will be
restarted when the process exits with a non-zero exit code, is
terminated by a signal (including on core dump, but excluding the
aforementioned four signals), when an operation (such as service
reload) times out, and when the configured watchdog timeout is
triggered.
on-abnormal - If set to on-abnormal
, the service will be restarted when
the process is terminated by a signal (including on core dump,
excluding the aforementioned four signals), when an operation times
out, or when the watchdog timeout is triggered.
on-abort - If set to on-abort
, the service will be restarted only if the service process exits due to
an uncaught signal not specified as a clean exit status. If set to
on-watchdog, the service will be restarted only if the watchdog
timeout for the service expires.
always - If set to always
, the service will be
restarted regardless of whether it exited cleanly or not, got
terminated abnormally by a signal, or hit a timeout.
See also this wonderful answer! https://unix.stackexchange.com/a/507917/119816