#!/bin/bash
# script voor het synchroniseren van deze server (doel) met de thuisserver (bron)
# BenMakkink 03-12-2020
# ********************************************************************************
# Include verborgen bestand met het rsync wachtwoord van de thuisserver
. /usr/local/bin/.rsync_access_to_thuisserver
echo;
echo "=====================================================================================";
echo "PASOP, de geselecteerde data van 192.168.178.4 overschrijven de data op deze server!!";
echo "=====================================================================================";
yn="n";
echo -n "Wil je echt hiermee doorgaan?? N/Y: ";
read yn;
case $yn in [Nn])
	exit;;
esac;
echo;
echo "Synchronisatie van /home/ububen";
echo "====================================";
yn="n";
echo -n "Uitvoeren? Y/N:";
read yn;
case $yn in [Yy])
sshpass -p$RSYNC_PWD rsync -avzh --delete root@192.168.178.4:/home/ububen/ /home/ububen;;
esac;
echo;
echo "Synchronisatie van de share Afbeeldingen";
echo "========================================";
yn="n";
echo -n "Uitvoeren? Y/N:";
read yn;
case $yn in [Yy])
sshpass -p$RSYNC_PWD rsync -avzh --delete root@192.168.178.4:/home/files/afbeeldingen/ /home/files/afbeeldingen;;
esac;
echo;
echo "Synchronisatie van de share Documenten";
echo "======================================";
yn="n";
echo -n "Uitvoeren? Y/N:";
read yn;
case $yn in [Yy])
sshpass -p$RSYNC_PWD rsync -avzh --delete root@192.168.178.4:/home/files/documenten/ /home/files/documenten;;
esac;
echo;
echo "Synchronisatie van de share E-books";
echo "===================================";
yn="n";
echo -n "Uitvoeren? Y/N:";
read yn;
case $yn in [Yy])
sshpass -p$RSYNC_PWD rsync -avzh --delete root@192.168.178.4:/home/files/e-books/ /home/files/e-books;;
esac;
echo;
echo "Synchronisatie van de share Muziek";
echo "==================================";
yn="n";
echo -n "Uitvoeren? Y/N:";
read yn;
case $yn in [Yy])
sshpass -p$RSYNC_PWD rsync -avzh --delete root@192.168.178.4:/home/files/muziek/ /home/files/muziek;;
esac;
echo;
echo "Synchronisatie van de share Video";
echo "=================================";
yn="n";
echo -n "Uitvoeren? Y/N:";
read yn;
case $yn in [Yy])
sshpass -p$RSYNC_PWD rsync -avzh --delete root@192.168.178.4:/home/files/video/ /home/files/video;;
esac;
echo;
echo "Synchronisatie van het Archief";
echo "==============================";
yn="n";
echo -n "Uitvoeren? Y/N:";
read yn;
case $yn in [Yy])
sshpass -p$RSYNC_PWD rsync -avzh --delete root@192.168.178.4:/home/archief/ /home/archief;;
esac;
echo;
echo "Synchronisatie van webroot /var/www/html";
echo "========================================";
yn="n";
echo -n "Uitvoeren? Y/N:";
read yn;
case $yn in [Yy])
sshpass -p$RSYNC_PWD rsync -avzh --delete root@192.168.178.4:/store/live/webroot/ /store/live/webroot;;
esac;
echo;
echo "Synchronisatie van de Wordpress /home/wpdata";
echo "============================================";
yn="n";
echo -n "Uitvoeren? Y/N:";
read yn;
case $yn in [Yy])
sshpass -p$RSYNC_PWD rsync -avzh --delete root@192.168.178.4:/home/wpdata/ /home/wpdata;;
esac;
echo;
echo "WORDPRESS UPDATEN MET /home/wpdata";
echo "=================================="
echo "Synchroniseer eerst /store/live/webroot met daarin de website ../blog";
echo "# cd /home/wpdata/dbase_dump";
echo "# mysqladmin -uroot -p'kn1kk@M!48' drop wordpress;";
echo "# mysql -uroot -p'kn1kk@M!48' < wp-dumpxxxxxxxx.sql;";
echo;
# echo "Synchronisatie van de Piwigo-backup";
echo "Synchronisatie van de Piwigo /home/pwgdata";
echo "==========================================";
yn="n";
echo -n "Uitvoeren? Y/N:";
read yn;
case $yn in [Yy])
sshpass -p$RSYNC_PWD rsync -avzh --delete root@192.168.1.4:/home/pwgdata/ /home/pwgdata;;
esac;
echo;
echo "PIWIGO UPDATEN MET /home/pwgdata";
echo "================================"
echo "Synchroniseer eerst /store/live/webroot met daarin de website ../piwigo";
echo "# cd /home/pwgdata/dbase_dump";
echo "# mysqladmin -uroot -p'kn1kk@M!48' drop piwigo;";
echo "# mysql -uroot -p'kn1kk@M!48' < piwigo-dumpxxxxxxxx.sql;";
