I can sync folders with rsync -avz /directory /target, now I wish to do it if I changed a file in /directory so rsync should be called automatically.
I am using Virtual Box and the shared folder of Virtual Box is really slow, especially if you have a webpage which is using the shared folder as document root. With rsync i would be able to work with my local files on shared folder and sync it automatically with document root.
I hope someone has an idea how to do so,crontab would be not good, because it is executed each x minutes, so if i don't do anything, it will still call rsync but not if I modified my file.
Best regards
i have virtual box installed with vagrant, there i have a shared folder "projects" it is mounted on boot, all my webserver files are located there so i can modify them on my host system(win7)
as i told virtual box shared folders are really slow, so solution could be to sync the mounted nfs folder to another place e.g /var/www
but the common ways are not working, i tryed fileschanged, icrontab, gues gamin or fam would help, but i dont know how to start or use them
– BlackScorp Aug 30 '13 at 10:55i will try the rsyn + cronjob solution or the php build in webserver
– BlackScorp Oct 22 '13 at 06:29inotifywaitsolution has one slight but important drawback: it does not detect changes which happened whenrsyncis running. Consider the following situation: file A is changed; rsync is triggered; when rsync is almost done synchronizing file A, file B is changed. Now,rsyncfinished andinotifywaitis running, but file B is not synchronized and won't be synchronized until some next change. Consider usinglsyncdas suggested by @Arigion. – MarSoft Jul 25 '19 at 13:54