LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   CentOS (https://www.linuxquestions.org/questions/centos-111/)
-   -   incrontab rsync (https://www.linuxquestions.org/questions/centos-111/incrontab-rsync-4175676360/)

kalyan1709 06-02-2020 12:39 PM

incrontab rsync
 
Hi,

I am trying to rsync a folder to multiple destinations

EX:
1. /data/xyz/abc/ IN_CREATE,IN_DELETE,IN_CLOSE_WRITE /usr/bin/rsync --exclude '*.tmp' -a /data/xyz/abc/ user1@host1:/data/kalyan/

2. /data/xyz/abc/ IN_CREATE,IN_DELETE,IN_CLOSE_WRITE /usr/bin/rsync --exclude '*.tmp' -a /data/xyz/abc/ user1@host2:/data/test/kumar/

Here 1st one is perfectly syncing but the 2nd one never works. Like this I am trying to rsync "/data/xyz/abc/" to multiple servers in multiple locations.
When I run rsync manually(/usr/bin/rsync --exclude '*.tmp' -a /data/xyz/abc/ user1@host2:/data/test/kumar/) it is working with out any errors but in incrontab it won't trigger automatically like #1

Any help please?

michaelk 06-02-2020 04:06 PM

My guess is once inotify is triggered the second job will never run since it is watching the same directory. Move both rsync commands to a single script and have incron run that script instead of two entries.


All times are GMT -5. The time now is 07:21 AM.