At 12:08 PM +0300 7/2/03, Jim Xochellis wrote:

I suspected that some processes are confused because a *new* log file is created and these processes are making the assumption that their log file will be always the same and perhaps they open it once and then work with the FILE pointer.

If a program responds to SIGHUP by re-opening all of it's files, then it really should re-open the log file. If the program does not re-open the logfile when it get a SIGHUP, then it is more accurate to say it is ignoring the SIGHUP (as far as that log file is concerned). Ie, there is no way that it is "correct" for the program to behave in the way you describe, if it is trying to do "the right thing" with the log file.

I have confirmed that newsyslog actually creates a new
log file (instead of copying it and then disposing its
contents) by reading the source of the newsyslog.c file

Yes, and that doen because it is the safest and most reliable way for it to rotate a logfile without any hitting any race-conditions.

Having the above in mind, isn't it worthwhile to add an
option in newsyslog in order to avoid the creation of a
new log file when it is inconvenient?

This does not seem like a good idea to me. It might work okay in the case where you are keeping no backup files, but it is a really bad idea if you want to rotate the information to backup files.

Isn't it feasible to dispose the contents of the old log
file instead of creating a new one?  Anything that I am
missing here? (giving the fact that I am not a unix guru,
only a C programmer)

If the program does not have some way to REALLY re-open the log file, then the file-pointer might also be pointing to a specific point in the file. Let's say it is at byte 125000 into the file. You empty the file. The next time the program writes to the log file, it will write to byte 125001 (depending on how the program is written). Some programs may work with this strategy, but others will not.

I think you should look at the programs you are having trouble
with, and see if there is some alternate way to get them to
correctly handle the log file that you want to rotate.

disclaimer: I am about to go on holiday/vacation for a few
days, so all of the above comments were just my initial
reaction.  I realize this reply is not very helpful, but
I'll try to write up something more helpful if no one else
comes up with a good solution for you.

Garance Alistair Drosehn            =   [EMAIL PROTECTED]
Senior Systems Programmer           or  [EMAIL PROTECTED]
Rensselaer Polytechnic Institute    or  [EMAIL PROTECTED]
[EMAIL PROTECTED] mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to