# Auto Restart Services

[https://www.redhat.com/sysadmin/systemd-automate-recovery](https://www.redhat.com/sysadmin/systemd-automate-recovery)

1\) Edit elasticsearch service unit file using the following command

```
systemctl edit elasticsearch.service 
```

2\) Now, add the following lines in the unit file.

```
[Service]
Restart=always
```

3\) Refresh the unit file using command

```
sudo systemctl daemon-reload
```