Re: Log rolling with a daemon

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



On Sat, Dec 21, 2013 at 8:52 PM, John R Pierce <pierce@xxxxxxxxxxxx> wrote:
> On 12/21/2013 4:56 PM, Larry Martell wrote:
>> I'm looking for advice or suggestions for rolling log files with a
>> daemon. I have a python script that I daemonized with
>> http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/.
>> Before I daemonized it it was run from a bash script that invoked the
>> underlying python script. It ran the python script, waited for it to
>> complete and then it slept for 5 seconds and ran it again. This was in
>> a infinite loop. In between each invocation it checked the log file
>> and if it was over 10MB it renamed it and then the next invocation
>> started with a new empty log. Since each invocation was a separate run
>> this worked fine.  But now the daemonized python script doesn't exit -
>> the same log file is attached to it forever. So my renaming of the
>> file does nothing - the i node doesn't change and it's still logging
>> to the same large file. Anyone have any ideas how I can achieve this
>> sort of log rolling in this situation?
>>
>
> send a SIGHUP to syslog  and it shoudl re-opent he log files.
>
> silly question, but whats wrong with the logrotate daemon thats built
> into centos?

This is not using syslog. If you look at the daemonizing script I gave
the link to, you pass in the log files for stdout and stderr, and it
does some double fork magic and then associates the given files with
them.
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux