Re: Holding files open and locking

1999-12-19 Thread G.W. Haywood
Hi Bill, On Sun, 19 Dec 1999, Bill Moseley wrote: > Can anyone recommend a good method to archive a log file There's loads of stuff for managing logfiles knocking about. I know you said you'd looked at the Guide, but what was the version you last downloaded? There's a bit in control.pod abou

Re: Holding files open and locking

1999-12-19 Thread Bill Moseley
At 02:40 PM 12/19/99 -0400, Eric L. Brine wrote: >How about: > sub cleanup { >flock(FH, LOCK_UN); > } > > $SIG{__DIE__} = sub { >cleanup(); >die($_[0]); > }; > > END { cleanup(); } > >You'll never been able to write to the file if you don't unlock a shared >lock. Oh, I do LOCK_S

Re: Holding files open and locking

1999-12-19 Thread Eric L. Brine
> In a Registry script I open a file the first request and set a global > variable flag. Then for each request I just flock( FH, LOCK_SH ) and > flock( FH, LOCK_UN). > > The only problem I see is that if the lock isn't released I need to do > a graceful restart to get rid of that lock. (But t

Holding files open and locking

1999-12-19 Thread Bill Moseley
Below I'm asking what are common ways to do a few things with log files written by a Registry script. In summary: - does opening a file once per child save much time over once per request? - is writing to a log file without locking crazy? - what's a good way to gzip and purge live log files? (Ye