On Sun, Feb 20, 2005 at 08:15:42PM +0000, Karl Heyes
wrote:> setting <logsize> will cause an automatic log rotation when a certain
> file size has been reached. It renames <logfile> to <logfile>.1
then
> opens a new file <logfile>
Since all my other logs are rotated on a daily/weekly basis, I want my
ices logs to behave in the same way.
Nevertheless, this thread finally gave me the incentive to fix ices so
that it rotates logs on SIGHUP, which is much nicer. Here's the patch:
(The second LOG_INFO0, apart from verboseness, ensures that the new
logfile is created right away.)
--- ices2-2.0.0-kh59.orig/src/signals.c
+++ ices2-2.0.0-kh59/src/signals.c
@@ -51,9 +51,11 @@
void signal_hup_handler(int signum __attribute__((unused)))
{
LOG_INFO0("Flushing logs");
- log_flush(ices_config->log_id);
+ log_reopen(ices_config->log_id);
+ LOG_INFO0("Reloading playlist");
ices_config->next_track = 1;
+
signal(SIGHUP, signal_hup_handler);
}
@@ -67,6 +69,7 @@
void signals_setup(void)
{
+ signal(SIGHUP, signal_hup_handler);
signal(SIGINT, signal_int_handler);
signal(SIGTERM, signal_int_handler);
signal(SIGUSR1, signal_usr1_handler);
--
Fr?d?ric Bri?re <*> fbriere@fbriere.net
=> <fbriere@abacom.com> IS NO MORE:
<http://www.abacomsucks.com> <=