Re: Can't get incron to work

From: <lukas_at_aiken.cz>
Date: Thu, 31 Jul 2008 17:02:04 +0200 (CEST)

Hi,
this behavior may be caused by multiple reasons. First try to find out how
the file is modified.

Why? Because some applications modify files by calling write(), some of
them by mmap()-ing (and writing to the mapped memory), and some of them by
creating a copy of the file and renaming at the end. The third way (used
i.e. by jEdit) is the one where IN_MODIFY doesn't work.

How to do it? Create a rule for monitoring the parent directory. Here is
an example:

/home/andy IN_MODIFY,IN_CLOSE_WRITE,IN_CREATE,IN_MOVED_TO,IN_DELETE
/home/andy/myscript $# $%

Before this, create a script "myscript" (in /home/andy) which can have
these lines:

#!/bin/sh
echo $1 $2 > /tmp/myscript.log

Proceed the file modification (test.txt) the way how it is done regularly
and then check the log file (/tmp/myscript.log). If you know how the file
is modified you can adapt your incron rule to cover it.

One more recommendation: do not use IN_MODIFY at all. Use IN_CLOSE_WRITE
instead. IN_MODIFY may be emitted when the monitored file is in
inconsistent state (file changes needn't be done in one step, especially
for various buffered streams).

Thanks for your interest in incron.

Lukas

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> i hav some problems getting incron to work as desired. My goal ist to
> upload the file test.txt to a server every time it changes.
>
> incrond is up and running
> i use incrontab -e and insert a line for testing:
>
> /home/andy/test.txt IN_MODIFY espeak "it works"
>
> after saving the file i see (in syslog) that incrond reloads my line
>
> Now i edit the file test.txt and at the moment i save it the speaker
> goes"it works"
>
> Now i do exactly the same again, and ... nothing
>
> Sometimes it works again after a short time, sometimes after reloading
> the crontab file (by saving it again). I can't see any pattern in when
> it works and when it won't.
>
> Any Hints anyone?
>
> Andy
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFIkcUZjsqVO1/PdpwRAq4ZAJ9z4avYLMCdhrqECU/pbSIIExXMmACgg/NL
> ypAjSPQuPYxlquBpy+JRmPk=
> =WtQK
> -----END PGP SIGNATURE-----
>
>
Received on Thu Jul 31 2008 - 17:02:33 CEST

This archive was generated by hypermail 2.2.0 : Tue Jun 05 2012 - 22:14:21 CEST