Computer Tips - systemd: restart down service

Date: 2019nov11 Product: systemd OS: Linux Q. systemd: restart down service A. A big benefit of systemd over traditional service launchers is its ability to monitor services and optionally restart them if they stop unexpectedly. In the past I would write little scripts to ensure important services were running. Now you can simply use Restart=always in the service's unit file. This will restart the service if crashes. For example, for dnsmasq (it stops sometimes):
[Unit] Description=DNS caching server. After=network.target [Service] ExecStart=/usr/sbin/dnsmasq -k Restart=always <!--- KEY LINE [Install] WantedBy=multi-user.target
There are other choices for the Restart option https://www.freedesktop.org/software/systemd/man/systemd.service.html