How to set up a systemd service to retry 5 times on a cycle of 30 seconds -


i want systemd start script , retry maximum of 5 times, 30s apart. reading systemd.service manual , searching internet didn't produce obvious answers.

after trial , error solved problem , thought worth posting here...

to allow maximum of 5 retries separated 30 seconds use following options in relevant systemd service file.

restart=always restartsec=30 startlimitinterval=200 startlimitburst=5 

this worked worked me service runs script using 'type=idle'. note 'startlimitinterval' must greater 'restartsec * startlimitburst' otherwise service restarted indefinitely.


Comments