Newer
Older
WordPress-Load-Balance-Layer-7 / lsyncd.sh
#!/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;

echo "Mencoba melakukan restart service lsycnd !"
echo "";
echo "";
systemctl restart lsyncd;
echo -ne '====>                     (33%)\r'
sleep 1
echo -ne '=======>                  (45%)\r'
sleep 1
echo -ne '===============>          (66%)\r'
sleep 1
echo -ne '=========================>(100%)\r'
echo -ne '\n'
echo "Ini status servicenya !"
echo "";
echo "";
systemctl status lsyncd;
echo "";
echo "";
echo "Tolong dicek status servicenya !";
echo "";
echo "";
echo "Mencoba merestart webserver dan php pada backend2 !";
echo "";
echo -ne '====>                     (33%)\r'
sleep 1
echo -ne '=======>                  (45%)\r'
sleep 1
echo -ne '===============>          (66%)\r'
sleep 1
echo -ne '=========================>(100%)\r'
echo -ne '\n'
ssh root@103.23.20.132 "nginx -t; nginx -s reload; systemctl status nginx;systemctl restart php-fpm";