Re: Loosing STDOUT after file rotation

From: Dan Nelson (dnelson_at_allantgroup.com)
Date: 04/02/04

  • Next message: Daniel O'Connor: "Re: UT2004?"
    Date: Fri, 2 Apr 2004 10:18:44 -0600
    To: James Housley <jim@thehousleys.net>
    
    

    In the last episode (Apr 01), James Housley said:
    > 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.

    Run "program_name 2>&1 | logger daemon.notice -t program_name", so
    messages go through syslog (/etc/rc.d/bgfsck does this). You can use
    programname filtering in syslog.conf to write that output to its own
    logfile. There's nothing program_name itself can do about the problem,
    since it didn't open the logfile; the shell did.

    -- 
    	Dan Nelson
    	dnelson@allantgroup.com
    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
    

  • Next message: Daniel O'Connor: "Re: UT2004?"