Bug 8683 - Squeezecenter .deb's logrotate should not restart SC
: Squeezecenter .deb's logrotate should not restart SC
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Misc
: 7.1
: PC Debian Linux
: P1 major (vote)
: 7.3.3
Assigned To: Matt Wise
:
Depends on: 1468
Blocks:
  Show dependency treegraph
 
Reported: 2008-07-09 11:34 UTC by Christian Hudon
Modified: 2009-09-08 09:18 UTC (History)
4 users (show)

See Also:
Category: ---


Attachments
Patch (898 bytes, patch)
2008-07-09 11:35 UTC, Christian Hudon
Details | Diff
rotate with USR1 (3.08 KB, patch)
2009-03-14 21:39 UTC, KDF
Details | Diff
Better version (3.04 KB, patch)
2009-03-14 22:48 UTC, KDF
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Hudon 2008-07-09 11:34:46 UTC
With the default install of the squeezecenter's .deb, I get an email every day from cron telling me that squeezecenter was restarted. This is caused by the following chain of events:

- The squeezecenter .deb installs a logrotate file that stops and starts squeezecenter when rotating its log files. 

- The logrotate program is run as a cron job, and cron is configured to email output of jobs by default.

The solution is simply to redirect stdout to /dev/null when stopping and starting squeezecenter in the log file. This is what the attached patch does.
Comment 1 Christian Hudon 2008-07-09 11:35:24 UTC
Created attachment 3548 [details]
Patch
Comment 2 Mark Miksis 2008-07-09 11:46:40 UTC
Why is the rotation happening every day?  Maybe "size 200k" is too small?
Comment 3 Christian Hudon 2008-07-10 14:08:53 UTC
I think it's because of all the warnings (about the cover.jpg files, etc.) when rescanning my music nightly. But it's not relevant to this bug report. I don't want to get an email every time squeezecenter is restarted by logrotate, even if it's once a week or once a month.
Comment 4 Blackketter Dean 2008-07-22 05:10:40 UTC
matt: can you review this patch?
Comment 5 Matt Wise 2008-07-22 08:37:17 UTC
I think the patch is fine... it is only affecting the logrotate script, which really (as he mentioned) probably shouldn't have any output at all. 
Comment 6 Mark Miksis 2008-07-22 08:43:34 UTC
The logrotate script in the RPM does the same thing as this patch to send output to /dev/null.  However, I still think something else is broken here if the logs are being rotated every day.  I suggest removing "size 200k" and testing.
Comment 7 Matt Wise 2008-07-22 08:46:16 UTC
Its not that unreasonable that his logs could be long... he might have turned some debugging on, or just have some noisy scanner results, or something. 
Comment 8 Mark Miksis 2008-07-22 08:54:27 UTC
Yeah, you're right.  I'm not sure what I was thinking...
Comment 9 Matt Wise 2008-08-11 09:23:03 UTC
Should be solved in change 22518. This should be a totally reasonable fix as its almost the same as what we're doing in the RedHat logrotate config file. 
Comment 10 Chris Owens 2008-08-11 10:17:22 UTC
Matt says this is fixed
Comment 11 Spies Steven 2008-08-26 11:50:13 UTC
Verified with SC 7.2 - 22892
Comment 12 James Richardson 2008-12-15 12:34:09 UTC
This bug has been fixed in the 7.3.0 release version of SqueezeCenter!

Please download the new version from http://www.slimdevices.com/su_downloads.html if you haven't already.  

If you are still experiencing this problem, feel free to reopen the bug with your new comments and we'll have another look.
Comment 13 Andy Grundman 2009-01-14 07:35:15 UTC
The deb should not auto-restart SC to rotate logs!

I'll do something with bug 1468 then this can be modified to use it.
Comment 14 Andy Grundman 2009-01-14 07:43:38 UTC
Note: the RPM also does this.
Comment 15 Andy Grundman 2009-01-26 09:24:12 UTC
Change 24754, USR1 will handle this for server.log.

Matt/Fletch: Can you please update the deb/rpm scripts to use this?

server.log needs a postrotate that sends USR1.  scanner.log should not need any actions, as it is only written by the scanner. 
Comment 16 KDF 2009-03-14 21:39:50 UTC
Created attachment 4927 [details]
rotate with USR1

Tested and works on Debian, so have applied similar lines to redhat, fedora and readynas.

Can commit anytime if it's desired.
Comment 17 KDF 2009-03-14 22:48:33 UTC
Created attachment 4928 [details]
Better version

Better, in that it allows the server to be restarted and rotated many times.  The previous version used the /var/run/squeezecenter.pid, which would be the squeezecenter_safe process instead of slimserver.pl.  pgrep finds the right pid and should hopefully work on all systems.
Comment 18 Andy Grundman 2009-03-15 06:28:25 UTC
Thanks, feel free to apply.
Comment 19 KDF 2009-03-15 14:11:21 UTC
Change 25546 has the patch for 7.3.3  please reopen if there are any issues with the change.
Comment 20 Marc Auslander 2009-03-17 06:33:34 UTC
my logrotate for squeezecenter (debian etch) contains:

# send USR1 to squeezecenter PID to reset logging
/bin/kill -USR1 `pgrep slimserver.pl 2>/dev/null` 2>/dev/null || :


this doesn't look right. there is no process with slimserver.pl in its command line.

don't you want to be searching for squeezecenter-server?

pgrep squeezecenter-s

gets the right answer on my system. (15 charater limit)
Comment 21 KDF 2009-03-17 07:54:44 UTC
are you sure that's not resetting squeezecenter_safe?   It will work by doing that, but only once as it then fails to restart and can't be found again when restarting the process.
Comment 22 KDF 2009-03-17 08:32:53 UTC
sorry my mistake, s/_/-/.

fixed at change 25580. thanks.
Comment 23 James Richardson 2009-06-17 09:35:19 UTC
This bug has been fixed in the 7.3.3 release version of SqueezeCenter!

If you haven't already. please download the new version from http://www.logitechsqueezebox.com/support/download-squeezecenter.html 

If you are still experiencing this problem, feel free to reopen the bug with your new comments and we'll have another look.