#!/bin/bash yum install lsyncd -y; echo "settings { logfile = $(echo '"/var/log/lsyncd/lsyncd.log"'), statusFile = $(echo '"/tmp/lsyncd.stat"'), statusInterval = 1, } sync { default.rsync, source = $(echo '"/var/www/html/wp"'), target = $(echo '"103.23.20.132:/var/www/html/wp"'), } sync { default.rsync, source = $(echo '"/etc/nginx/conf.d/"'), target = $(echo '"103.23.20.132:/etc/nginx/conf.d/"'), } rsync = { update = true, perms = true, owner = true, group = true, }" > /etc/lsyncd.conf; systemctl restart lsyncd; systemctl status lsyncd; ssh root@103.23.20.132 "nginx -t; nginx -s reload; systemctl status nginx;";