Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 509366 - app-admin/logrotate: Unify how service are restarted/reloaded on openRC and systemd for logrotate
Summary: app-admin/logrotate: Unify how service are restarted/reloaded on openRC and s...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
Depends on:
Reported: 2014-05-02 11:07 UTC by Pacho Ramos
Modified: 2020-09-30 18:00 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Pacho Ramos gentoo-dev 2014-05-02 11:07:03 UTC
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
Comment 1 Richard Freeman gentoo-dev 2014-05-02 20:14:31 UTC
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.
Comment 2 Pacho Ramos gentoo-dev 2014-05-03 08:25:52 UTC
What package could provide that wrapper? (I would vote for logrotate itself)
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-05-03 08:29:36 UTC
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.
Comment 4 Pacho Ramos gentoo-dev 2014-05-03 08:33:57 UTC
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
Comment 5 Richard Freeman gentoo-dev 2014-05-03 10:31:15 UTC
(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?
Comment 6 Pacho Ramos gentoo-dev 2014-05-03 12:45:32 UTC
per bug 493072 looks like also cron