After much trial and error, I solved my problem and thought it was worth posting here ...
To allow a maximum of 5 repetitions divided by 30 seconds, use the following parameters in the corresponding systemd service file.
[Unit] StartLimitInterval=200 StartLimitBurst=5 [Service] Restart=always RestartSec=30
This worked for me for a service that runs a script using 'Type = idle'. Please note that "StartLimitInterval" must be larger than "RestartSec * StartLimitBurst", otherwise the service will be restarted indefinitely.
source share