[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Log rotating - SIGALRM instead of SIGHUP and SIGUSR1



Hi there!

There was a long thread about SIGHUP and its usage to rotate logfiles. I
think SIGUSR1 is a better solution for this, but it's still the wrong
solution. I think we shouldn't need any external program/script to make
xchat to rotate the logs.

I took Ricardo B's SIGUSR1 patch and changed it to use SIGALRM and
alarm() to rotate the logs at midnight. But there are several problems
with this approach so I decided to use an other method. It's quite
simple, too. This second one stores the  time of the next midnight in a
variable. When some kind of message (eighter a PRIVMSG or a PING or etc.)
arrives, it compares this variable with the time of the arrival of the 
message. If the variable is smaller then it's time to rotate the logs. 
Problems with this approach are: it will not happen exactly at midnight 
but some time after midnight. I think this problem can be neglected,
because there are no problems with multiple SIGALARMs or no need for
additional scripts or external programs.

Both patches can be downloaded from:
http://www.sch.bme.hu/~szeder/xchat.html
And a brief description about my problems are also there. Please test it
if you can!

Feel free to include it in x-chat. [But only after heavy testing!] (;

I plan to make it possible that the user will be able to set the time
when the logfiles are to be rotated.

Regards,

Gabor Szeder

-- 
sz
--
XChat-discuss: mailing list for XChat users
Archive:       http://mail.nl.linux.org/xchat-discuss/