Search code examples
rsyncincron

incron and rsync not working


I have incron setup and working, i can see things being logged when files are changed. I've tried my rsync command separately and that works fine. But when rsync in triggered by incron, nothing happens. i explicitly stated all the paths i could see.

here is my incrontab -e

/home/dir/dir/ IN_MODIFY sudo rsync -pogr -e 'ssh -i /root/.ssh/rsasync1' /home/dir/dir/* root@ipaddress:/home/dir/dir/

i'm working as root right now and executing the command as root. also tried /usr/bin/rsync and that didn't work in addition to sudo rsync etc...

thanks!


Solution

  • Try this in incrontab:

    /home/dir/dir/ IN_MODIFY sudo rsync -pogr -e ssh -i /root/.ssh/rsasync1 /home/dir/dir/* root@ipaddress:/home/dir/dir/
    

    In above command I have removed the quotes. Incrontab can not run with Single quote OR double quote.

    Remember: Pleas keep the quote while executing in terminal.