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

u34 at net9.cf u34 at net9.cf
Mon Jul 31 22:27:35 UTC 2023


Ian Pilcher <arequipeno at gmail.com> wrote:

> 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.
> 

As your service doesn't have a way to directly restart httpd, does it 
have permissions to reload httpd? I mean, do not you have a problem with 
your logic, a problem which makes the question about conditional reloading 
less important?

--
u34

> Any ideas?
> 
> Thanks!
> 
> -- 
> ========================================================================
> Google                                      Where SkyNet meets Idiocracy
> ========================================================================


More information about the systemd-devel mailing list