[systemd-devel] how make reload=restart

Lennart Poettering lennart at poettering.net
Tue May 10 09:59:16 PDT 2011


On Tue, 10.05.11 20:50, Alexey Shabalin (a.shabalin at gmail.com) wrote:

> 
> 2011/5/10 Lennart Poettering <lennart at poettering.net>:
> > On Tue, 10.05.11 20:03, Alexey Shabalin (a.shabalin at gmail.com) wrote:
> >
> >> Hello!
> >>
> >> Our logrotate after finish run script syslog-reload (detect syslog
> >> daemon - sysklogd or syslog-ng or rsyslog, and run service foo reload)
> >> But some services do not support reload, for example rsyslog.
> >> In init.d/rsyslog i can add reload=restart
> >> Very necessary add option to foo.service like
> >> Reload=Restart
> >> or
> >> ExecReload=Restart
> >
> > reloading implies that a service stays available all the
> > time. restarting usually means there's a window where the service is not
> > available. We do not want to blur this difference in systemd, hence we
> > do not turn reload requests into restart requests automatically.
> >
> > If you want an automatic fallback to restarting if reloading is not
> > available for a service please use "systemctl reload-or-restart ..."
> > which will to exactly that for you.
> 
> Can i use in rsyslog.service?
> ExecReload=/bin/systemctl restart rsyslog.service

No. This will neither work, nor do I like the idea. Services should
behave reliable. I think it is a bad idea blurring the lines between
reload and restart. We shouldn't do this neither globally, nor for
specific services.

Instead, just use "systemctl reload-or-restart ..." in your client code
and things will work fine. We added "reload-or-restart" precisely for
use cases like this, so, go, use it!

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list