[PATCH] innfeed does not reopen (rotated) log file

Julien ÉLIE julien at trigofacile.com
Mon Jan 7 18:47:18 UTC 2013


Hi Russ,

>>> I just noticed that innfeed keeps open a deleted log/innfeed.log, while
>>> the current log/innfeed.log as well as all the available OLD logs are
>>> empty!
>>>
>>> The reason seems to be that rotation of innfeed.log was added to
>>> scanlogs for INN 2.5, but scanlogs doesn't send a signal for innfeed to
>>> reopen its log; and indeed there is (currently) no way to cause a
>>> running innfeed to do so.
>
> I have (finally) applied this patch to CURRENT and to the 2.5 branch.
> Thanks!  It's less than ideal, since innfeed really needs some mechanism
> to let go of that file, but it's better than what we're currently doing.

In innfeed/main.c, there is an openLogFile() function that does a 
freopen() of the innfeed log file.


Couldn't we just add a call to openLogFile() in the existing sighup() 
function in main.c?  This sighup() function currently reloads 
innfeed.conf and reconfigure hosts.


static void sighup (int sig UNUSED)
{
   notice ("ME reloading config file %s", configFile) ;

   if (!readConfig (configFile,NULL,false,loggingLevel > 0))
     {
       die ("ME config aborting, error parsing config file") ;
     }

   configHosts (talkToSelf) ;
}



We could either add openLogFile() here or create a new signal handler like:

setSigHandler(SIGUSR1, sigusr1);

static void sigusr1 (int sig UNUSED)
{
   notice ("ME reloading log file %s", logFile) ;
   openLogFile();
}


I do not know, though, whether SIGUSR1 is portable...

-- 
Julien ÉLIE

« Ex nihilo nihil. » (Perse)


More information about the inn-workers mailing list