Bug 1544446

Summary: Icecast logrotate doesn't work if started via Systemd service unit
Product: [Fedora] Fedora EPEL Reporter: Christian Affolter <c.affolter>
Component: icecastAssignee: Björn 'besser82' Esser <besser82>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: epel7CC: andreas, besser82, ppisar
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Christian Affolter 2018-02-12 14:20:40 UTC
The log rotation of the Icecast log files (/var/log/icecast/*.log) doesn't work if the Icecast server has been started via its systemd service unit (icecast.service), because the required Icecast PID file (/var/run/icecast/icecast.pid) is missing for SIGHUP to work.


Version-Release number of selected component (if applicable):
Name        : icecast
Arch        : x86_64
Version     : 2.4.2
Release     : 1.el7


How reproducible:
Install and start the Icecast server via systemctl and wait for the periodic logrotate to occur ("weekly" by default on CentOS 7, which can be changed to "daily" or "hourly" to speed things up).


Steps to Reproduce:
1. yum install icecast
2. systemctl start icecast
3. Wait for the logrotate to occur (or trigger it manually)
4. ls -la /var/log/icecast/

Actual results:
The Icecast server still logs to the old (rotated and date suffixed) log file instead of the newly created one.


Expected results:
Logrotate works as expected and the Icecast server logs to the newly created log file instead of the old (rotated) one.


Additional info:
The icecast logrotate snippet (/etc/logrotate.d/icecast) should either call "systemctl reload icecast.service" on systemd enabled systems or replace "cat [...]/icecast.pid" with "pidof icecast", to send a SIGHUP to the Icecast daemon which will trigger the server to re-open the log files.


# Variant with systemctl reload (for systemd enabled systems)
/var/log/icecast/*log {
    [...]
    postrotate
	/usr/bin/systemctl reload icecast.service 2> /dev/null || true
    endscript
}


# Variant with pidof (which should work on non-systemd and systemd enabled systems)
/var/log/icecast/*log {
    [...]
    postrotate
	/bin/kill -HUP `pidof icecast 2>/dev/null` 2> /dev/null || true
    endscript
}