Catch file modify event in linux
Use IN_CLOSE_WRITE as the modified event in linux

IN_MODIFY event will be fired multiple times (about 10 times
when creating a 1MB file). This causes lots of unnecessary db update.
We only want one modify event when creating a new file. IN_CLOSE_WRITE
seems to do the right job. It means file opened for writing was closed.
This is almost what we want, except for files that are opened for
wrting for a long time and are never closed.