On my server I use elasticSearch which regularly gets down and the result is a 500 error for my users. I understand Systemd is now the reference for managing services.
How can I use Systemd to restart my elastic search service automatically when it gets down ? I found ways to restart it but not automatically, without me checking if it’s down.
If you are using a systemd service file to start your service, then add the lines below to your service file from where you are starting your service:
[Service] Type=simple ExecStart=here will be your service executable name Restart=always RestartSec=0
Configures whether the service shall be restarted when the service process exits, is killed, or a timeout is reached. Takes one of the following values:
always. If set to
Configures the time to sleep before restarting a service (as configured with
Restart=). Takes a unit-less value in seconds.
These two options have to be under the
[Service] tag in a service file.
Answered By – Rathin Paul
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0