[TAG] Question about file mtime on linux

Karl-Heinz Herrmann kh1 at khherrmann.de
Thu Apr 14 00:13:25 MSD 2005


Hi,

On Wed, 13 Apr 2005 12:29:15 -0700 (PDT)
Suramya Tomar <suramya at yahoo.com> wrote:

> I have a question for you about file mtime(modify
> time) on linux. Does the mtime stamp of a file change
> as soon as a process starts modifying the file or does
> it change it after the change is done?

Hmm.. no idea, but its an intersting question. 

> So how would I check that the file change is done?One
> way would be to keep checking in a loop if the mtime
> changed if it did goto sleep and check again after a
> few seconds, keep repeating this until the mtime stop
> changing. But in my opinion this is a stupid way of
> doing this so I am hoping one of you has a better way
> of doing it.


File locking might be useful. The script sees the change in the mtime,
then waits for the lock to go away and starts processing.  You would
have to tell the modifying program to use file locking though. 

K.-H.




More information about the TAG mailing list