Bug 1544446 - Icecast logrotate doesn't work if started via Systemd service unit
Summary: Icecast logrotate doesn't work if started via Systemd service unit
Keywords:
Status: NEW
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: icecast
Version: epel7
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Björn 'besser82' Esser
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-02-12 14:20 UTC by Christian Affolter
Modified: 2018-02-12 14:20 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

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
}


Note You need to log in before you can comment on or make changes to this bug.