Dear Jim, James Housley wrote on Thu, Apr 01, 2004 at 04:53:19PM -0500: > I have a program that I have the is supposed to run forever. I log any > output to a log file. It is run in a startup script like thie: > > program_name >> $err_log 2>&1 > > The problem is that after newsyslog rotates the $err_log file, no more > data is written to the file. I can not stop and restart the program. I
You mean no date is written to the new file? I bet data is still pouring into the old file, which is probably just renamed after rotation. The reason is simple. Once you start your program, you open a filehandle to your error_log file. This handle stays valid until the file is closed (e.g. when the progress dies). Just renaming the file does not invalidate the filehandle. And of course there is no magic which closes this filehandle and opens the new file. > can accept a signal. But what do I need to do in "program_name" to allow > the data to be written after the "rotation" of the file. Don't log to STDOUT/STDERR. Open the file inside of your program. Install a signal handler (e.g. catching SIGHUP), which closes the file and reopens it, be sure to update your references to the filehandle (which may change of course). Hope this helps, Daniel -- IRCnet: Mr-Spock - kommst du siehst du, gehst du hast du, weisst du, krass! - Daniel Lang * [EMAIL PROTECTED] * +49 89 289 18532 * http://www.leo.org/~dl/
smime.p7s
Description: S/MIME cryptographic signature