[lug] how to handle open files - upload server

vlad vlad at modomail.com
Tue Jan 13 19:05:17 MST 2004

Hello.  First post here, but I thought I'd throw in my two cents:

1.  I've had problems with locking libs in earlier versions of Linux.  
Can't remember if it was flock or fcntl, but I'd check out the problems 
with each if you're running around RH 7.2-7.3.

2.  The answer to everything is Perl ;)  If this works, test the 
modification time on it and if it's within a threshhold, move it.  Wait 
a moment, then test again.
 eg: perl -e 'print (time-(stat("/var/log/maillog"))[9]);'

.. will display the seconds since that file was last modified.  Of 
course you'll have to think about syslogd caching something, but if 
you're not sending a rocket to the mars, this may work for you.



Bear Giles wrote:

> rm at fabula.de wrote:
>>  A _big_ caveat: all these techniques use non-atomic operations and
>>  hence are vulnerable to race conditions (well, i'm not shure about
>>  exclusive locking allone, i'd have to look it up).
> Locking is handled in the kernel, so atomic operation shouldn't be a 
> problem.
> As for whether the files are locked, check 
> /usr/src/linux/Documentation/locks.txt and mandatory.txt.  The OP may 
> need to mount the incoming directory with some special mount flags, 
> but he should be using a dedicated partition anyway to prevent a DOS 
> attack by somebody sftp'ing /dev/null at him. :-)
> Bear
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug

More information about the LUG mailing list