While going to fix bugs like bug 508512 I noticed two issues:
1. Some packages reload the services unconditionally, this can be fixed as done in munin logrotate file.
2. Some packages run "restart" others run "reload"...
3. Some packages run "restart" only if service was already started. This makes sense but should be done in all packages, right?
On systemd side I would opt for running "systemctl reload-or-try-restart" because it will try reload, then restart *and* will only do anything if service was already running.
But I don't know if openRC has any equivalent for this :/
Thanks a lot
Absent some kind of universal openrc/systemd API, I'd think a wrapper script would make the most sense. I think systemd will allow restart requests to come in via dbus (if not now, then at some point in the future), but I doubt openrc supports this.
A wrapper script could determine what service manager is in use and then call the appropriate command to restart or reload the service.
What package could provide that wrapper? (I would vote for logrotate itself)
I would like to note that every package would still need to explicitly name the proper script/service name for each init supported. And I guess some packages may have different number of those for different inits.
I guess the wrapper should act like:
wrapper --systemd=unit1,unit2,unit3 --openrc=init.d1,init.d2
Anyway, my main concern was about openrc having something equivalent to "reload-or-try-restart" to:
1. Try reload and, if not possible, try restart
2. Only start the service if it was previously running
(In reply to Pacho Ramos from comment #2)
> What package could provide that wrapper? (I would vote for logrotate itself)
Well, if logrotate were the ONLY package that restarted services, then that would make sense. Otherwise it would make sense to make this a standalone package, or part of some system package.
Does anything else need to restart services? Tmpreaper perhaps?
per bug 493072 looks like also cron