[systemd-devel] Conditionally reload a service from another service

Ian Pilcher arequipeno at gmail.com
Mon Jul 31 20:23:26 UTC 2023


What is the recommended way for a service that runs as a non-root user
to *conditionally* restart (or reload) another service?

I have created service (along with an associated timer) that checks the
remaining life of a TLS certificate and retrieves an updated certificate
from Let's Encrypt if the remaining life is too short.

I am trying to figure out the best way to restart Apache (httpd.service)
*if* the certificate is updated.

* My service runs as a non-root user, so (AFAIK), there is no way for it
   to directly restart httpd.  (At least not without all the pain of
   starting as root, dropping privileges, etc.)

* I could add 'ExecStartPost=systemctl reload httpd.service' to my unit
   file, but I don't believe that there's any way to make that
   conditional.

Any ideas?

Thanks!

-- 
========================================================================
Google                                      Where SkyNet meets Idiocracy
========================================================================


More information about the systemd-devel mailing list