- Edit elasticsearch service unit file using the following command
sudo systemctl edit elasticsearch.service
- This command will create a file
/etc/systemd/system/elasticsearch.service.d/override.conf
- Now, add the following lines in the unit file.
[Service]
Restart=always
- Refresh the unit file using command
sudo systemctl daemon-reload
- Can check the changes using command
sudo systemctl cat elasticsearch.service