You are not logged in.

#1 2019-12-12 19:36:31

ttoirrah
Member
Registered: 2015-01-29
Posts: 61

Viability of incron

So I do this:

# pacman -S incron
...
Packages (1) incron-0.5.12-3
...
# systemctl enable incrond.service
# systemctl start incrond.service
$ touch file1 file2
$ incrontab -e

then I add this line to my incrontab:

/home/jo/file1 IN_MODIFY cp -f /home/jo/file1 /home/jo/file2

and save that. Then,

$ echo "some text" > file1
$ cat file1
some text
$ cat file2
some text

- so it's working, but when I make changes to file1 with Vim, only the first change gets propagated to file2, and after that the connection is broken.

My conclusion is that incron really isn't reliable, and maybe that should be stated in the Arch Wiki page - incron.

Offline

#2 2019-12-13 07:45:59

aiBo
Member
Registered: 2010-11-10
Posts: 50

Re: Viability of incron

Try with IN_CLOSE_WRITE instead of IN_MODIFY. The difference is that the second one triggers on each write which can mess up if your triggered command is not handling the event fast enough. The first one is only triggering once, which should be sufficient for your purpose.

Offline

#3 2019-12-17 19:31:56

ttoirrah
Member
Registered: 2015-01-29
Posts: 61

Re: Viability of incron

Nope, IN_CLOSE_WRITE doesn't help, nothing is transmitted from file1 to file2, and where previously I had this:

# systemctl status incrond.service
...
... PATH (/home/jo/1) FILE () EVENT (IN_MODIFY)
... (jo) CMD (cp -f /home/jo/file1 /home/jo/file2)

which was nevertheless failing to effectuate that copy, there's now this:

# systemctl status incrond.service
...
... access denied on /home/jo/file1 - events will be discarded silently

Offline

#4 2019-12-17 20:01:57

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,710
Website

Re: Viability of incron

Is this content duplication an academic problem or your actual use case?
In the latter case you might be better off with a hard link.

Last edited by schard (2019-12-17 20:03:23)


Inofficial first vice president of the Rust Evangelism Strike Force

Offline

Board footer

Powered by FluxBB