phoenix services

if you have some important apps running in the context of a service, meaning you can start them by running systemctl start myApp you can also configure them to automatically restart if they die.

  1. locate your unit’s service file by running sudo systemctl status myApp.
  2. read the loaded line, this tells you where systemctl found the service file to load.
  3. open this service file in your editor of choice.
  4. in the [Service] unit, add this:
    Restart=always
  5. in the [Unit] unit, add these:
    StartLimitIntervalSec=10
    StartLimitBurst=5
  6. run sudo systemctl daemon-reload

that’s it. your service will now restart itself if it ever dies, and if it dies and doesn’t successfully start due to error 5 times in 10 seconds, it will stop automatically trying to restart itself.

Leave a Reply

Your email address will not be published. Required fields are marked *