master.darin.web.id
ip address : 103.43.x.34
slave.darin.web.id
ip address : 103.43.x.36
-a : archive file -v : verbose the process -z : compress file -e : archive file first -h : human readable
If there are changes to the source directory such as deleting of files, the files on the remote host will remain and will not be deleted. Therefore, you can use --delete option so that the files on the remote host are also deleted (sync). Below is the command:
rsync -avzh --delete -e ssh /var/www/html [email protected]:/var/www/
Then you can use cron to synchronize files between hosts automatically.
vim etc/crontab
15 * * * * root /usr/bin/rsync -avz --delete -e ssh /var/www/html [email protected]:/var/www/
systemctl restart crond systemctl enable crond