Loosing STDOUT after file rotation

Roman Neuhauser neuhauser at chello.cz
Fri Apr 2 08:54:51 PST 2004


# jim at thehousleys.net / 2004-04-01 16:53:19 -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 
> 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.

    the program still writes to the original file. file != filename.
    you need to have newsyslog send the daemon a signal; the program
    needs to reopen the path in the signal handler.

-- 
If you cc me or remove the list(s) completely I'll most likely ignore
your message.    see http://www.eyrie.org./~eagle/faqs/questions.html


More information about the freebsd-hackers mailing list