Auto-restart service with Systemd
-
I've used monit and supervisord previously to restart services that have been stopped. Systemd ships with this support natively. So if you want to make sure chronyd restarts you would do this:
systemctl edit chronyd
Then enter:
[Service] Restart=always
Then finally run:
systemctl daemon-reload
That's it. It stores a file under /etc/systemd/system/chronyd.service.d/ called overrides.conf with that exact text we entered above. This also means we can push this out with our CM tool.
-
I believe that this is set automatically with Salt if you use the "Restart=True" option for a service.
-
@scottalanmiller said in Auto-restart service with Systemd:
I believe that this is set automatically with Salt if you use the "Restart=True" option for a service.
I can't find that in the docs anywhere (at least in the past few mins).
I don't think ansible can do this. At least it's not stated if it can.
-
@stacksofplates said in Auto-restart service with Systemd:
@scottalanmiller said in Auto-restart service with Systemd:
I believe that this is set automatically with Salt if you use the "Restart=True" option for a service.
I can't find that in the docs anywhere (at least in the past few mins).
I don't think ansible can do this. At least it's not stated if it can.
I know that salt has the option. What mechanism it chooses I don't know.
-
@scottalanmiller said in Auto-restart service with Systemd:
@stacksofplates said in Auto-restart service with Systemd:
@scottalanmiller said in Auto-restart service with Systemd:
I believe that this is set automatically with Salt if you use the "Restart=True" option for a service.
I can't find that in the docs anywhere (at least in the past few mins).
I don't think ansible can do this. At least it's not stated if it can.
I know that salt has the option. What mechanism it chooses I don't know.
Ya I wonder how it can do that. It would only be able to do it on a system that has systemd, and how it would handle something without it.
Init can't do this, which is why monit and supervisord existed before.
-
systemd has got this since early development. this, among other things (PID 1 master process...etc), was one of the reasons Poettering designed systemd. It borrowed this idea from other systems like this