You are not logged in.
Pages: 1
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 -ethen I add this line to my incrontab:
/home/jo/file1 IN_MODIFY cp -f /home/jo/file1 /home/jo/file2and 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
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
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 silentlyOffline
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
Pages: 1