| Summary: | lighttpd: wrong postrotate clause in /etc/logrotate.d/lighttpd | ||
|---|---|---|---|
| Product: | Mageia | Reporter: | Luca Olivetti <luca> |
| Component: | RPM Packages | Assignee: | Mageia Bug Squad <bugsquad> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | Normal | CC: | luigiwalser |
| Version: | 4 | Keywords: | PATCH |
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Source RPM: | lighttpd | CVE: | |
| Status comment: | |||
| Bug Depends on: | 16555 | ||
| Bug Blocks: | |||
|
Description
Luca Olivetti
2015-05-15 19:02:51 CEST
fedora uses "killall -HUP" instead of "systemctl kill --signal=SIGHUP" http://pkgs.fedoraproject.org/cgit/lighttpd.git/tree/lighttpd.logrotate
Manuel Hiebel
2015-05-15 21:41:41 CEST
Keywords:
(none) =>
PATCH Thanks. Since lighttpd does accept the HUP signal, the better fix would be to fix the systemd unit so that it does accept the reload argument. CC:
(none) =>
luigiwalser Try adding this to lighttpd.service and let me know if it works. (in the [Service] section) ExecReload=/bin/kill -HUP $MAINPID I don't like it because it isn't actually reloading the configuration[*], it just closes and reopens the log files, but it works (actually I put an override in /etc/systemd/system/lighttpd.service):
.include /lib/systemd/system/lighttpd.service
[Service]
ExecReload=/bin/kill -HUP $MAINPID
Then issuing a "service lighttpd reload" I see this in /var/log/lighttpd/error.log
2015-05-18 21:14:29: (server.c.1242) logfiles cycled UID = 0 PID = 32178
so it works.
BTW this is what debian does, and I prefer either my solution or fedora's one, but whatever works is fine.
[*]from systemctl manpage:
reload NAME...
Asks all units listed on the command line to reload their configuration. Note that this will reload the service-specific configuration, not the unit configuration file of systemd. If
you want systemd to reload the configuration file of a unit, use the daemon-reload command. In other words: for the example case of Apache, this will reload Apache's httpd.conf in the
web server, not the apache.service systemd unit file.
If it doesn't reload the config files, that's not good. I thought it might, having seen this: http://redmine.lighttpd.net/projects/lighttpd/wiki/ScriptsCentOS but maybe that init script was no good too. I did also find this. It's very old, but maybe it still is valid: http://blog.lighttpd.net/articles/2005/09/02/graceful-restart/ So maybe that would translate to this? ExecReload=/bin/kill -INT $MAINPID && /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf The first script probably just abuses reload in order to write a "nice" logrotate conf file (as in debian), the second I don't know if it works or not, for me a stop/start is good enough, but this bug is about logrotate. BTW, it doesn't work: # systemctl reload lighttpd Job for lighttpd.service failed. See 'systemctl status lighttpd.service' and 'journalctl -xn' for details. # systemctl status lighttpd lighttpd.service - Lightning Fast Webserver With Light System Requirements Loaded: loaded (/etc/systemd/system/lighttpd.service; enabled) Active: failed (Result: exit-code) since dl 2015-05-18 21:35:59 CEST; 3s ago Process: 672 ExecReload=/bin/kill -INT $MAINPID && /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf (code=exited, status=1/FAILURE) Main PID: 543 (code=exited, status=0/SUCCESS) And this is /var/log/lighttpd/error.log 2015-05-18 21:33:32: (server.c.1430) unlink failed for: /run/lighttpd/lighttpd.pid 2 No such file or directory 2015-05-18 21:33:32: (server.c.1430) unlink failed for: /run/lighttpd/lighttpd.pid 2 No such file or directory 2015-05-18 21:33:32: (server.c.1442) [note] graceful shutdown started 2015-05-18 21:33:32: (server.c.1558) server stopped by UID = 0 PID = 31970 so I wouldn't touch ExecReload lighttpd is not very good at logging errors: running the above on the command line I see that it fails to bind the port because the previous instance is still using it # kill -INT 1241 && /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf 2015-05-18 21:45:52: (network.c.405) can't bind to port: 192.168.1.62 80 Address already in use So, really, don't touch ExecReload Bummer. It would be good to get proper reload support implemented. I checked into SVN Fedora's killall method in logrotate. Hopefully this doesn't hurt any child processes. AFAIK there shouldn't be any child process. FWIW, even if it's not the subject of this bug, I found this: http://lists.freedesktop.org/archives/systemd-devel/2011-January/001067.html and it turns out there is a lighttpd-angel binary shipped with the rpm. Don't know why nobody seems to be using it in their init scripts. Yeah, it seems to be an unresolved issue. I opened bug #15980 for a systemd unit file using lighttpd-angel
Samuel Verschelde
2015-05-19 09:56:04 CEST
Version:
4 =>
Cauldron lighttpd-1.4.35-4.mga5 already fixed this bug for Cauldron yesterday. Version:
Cauldron =>
4 Thank you Status:
NEW =>
RESOLVED It's still present in Mageia 4, Luca. Status:
RESOLVED =>
REOPENED
David Walser
2015-09-02 17:20:38 CEST
Depends on:
(none) =>
16555 Fixed in: http://advisories.mageia.org/MGASA-2015-0338.html Status:
REOPENED =>
RESOLVED |