We have a service which is managed by systemd
. I'm looking for a way to programatically restart that service on demand - for instance, by sending a signal, writing to a file, or messaging over a socket.
Context: the systemd
managed service maintains a pool of headless chrome instances. But it manages them somewhat poorly, and over time they increase in number and memory usage. A systemctl restart
fixes that.
I could set RuntimeMaxSec
and Restart=always
to restart the proxy periodically, but it might be doing work at the moment the restart occurs.
Another service on that machine is the only consumer of the chrome proxy, and knows when it's not using it. So periodically when it's not using the chrome proxy (so that no requests will be dropped), it could restart it.
How could I do that?