Synchro
This commit is contained in:
parent
56b40a7b6c
commit
be46271d49
55
synchro.sh
55
synchro.sh
@ -2,27 +2,42 @@
|
|||||||
|
|
||||||
clear
|
clear
|
||||||
|
|
||||||
## NO MORE DB UPDATES ON THE PREPROD ##
|
ONLYPULL=1
|
||||||
|
|
||||||
#Dump local database
|
echo "Start Sync"
|
||||||
echo "Exporting the local Database"
|
|
||||||
mysqldump -h 192.168.0.41 -u root chocolatdemariage > chocolatdemariage.sql
|
if [ $ONLYPULL -eq 0 ]; then
|
||||||
printf "Export complete => file chocolatdemariage.sql has been created\n"
|
#Dump local database
|
||||||
|
echo "Exporting the local Database"
|
||||||
|
mysqldump -h 192.168.0.41 -u root chocolatdemariage > chocolatdemariage.sql
|
||||||
|
printf "Export complete => file chocolatdemariage.sql has been created\n"
|
||||||
|
|
||||||
|
printf "Replacing shop names\n"
|
||||||
|
sed -i -e 's/chocolatdemariage.local/chocolatdemariage.preprod.antadis.fr/g' chocolatdemariage.sql
|
||||||
|
|
||||||
|
printf "Sending the Database dump to the preprod server"
|
||||||
|
PORT="4096"
|
||||||
|
rsync -e "ssh -p$PORT" -az ./chocolatdemariage.sql root@chocolatdemariage.preprod.antadis.fr:/home/www/chocolatdemariage.preprod.antadis.fr
|
||||||
|
printf "Sending complete\n"
|
||||||
|
|
||||||
|
#printf "importing the Database on the preprod server\n"
|
||||||
|
ssh root@chocolatdemariage.preprod.antadis.fr -p4096 "cd /home/www/chocolatdemariage.preprod.antadis.fr \\
|
||||||
|
&& git pull origin master \\
|
||||||
|
&& mysql -u chocolatdemariage -pantadis78 chocolatdemariage < chocolatdemariage.sql \\
|
||||||
|
&& if [ -f /home/www/chocolatdemariage.preprod.antadis.fr/www/cache/class_index.php ] ; then rm /home/www/chocolatdemariage.preprod.antadis.fr/www/cache/class_index.php ; fi \\
|
||||||
|
&& mkdir -p /home/www/chocolatdemariage.preprod.antadis.fr/www/{log,upload} \\
|
||||||
|
&& chown -R www-data:www-data www/* \\
|
||||||
|
"
|
||||||
|
else
|
||||||
|
ssh root@chocolatdemariage.preprod.antadis.fr -p4096 "cd /home/www/chocolatdemariage.preprod.antadis.fr \\
|
||||||
|
&& git pull origin master \\
|
||||||
|
&& if [ -f /home/www/chocolatdemariage.preprod.antadis.fr/www/cache/class_index.php ] ; then rm /home/www/chocolatdemariage.preprod.antadis.fr/www/cache/class_index.php ; fi \\
|
||||||
|
&& mkdir -p /home/www/chocolatdemariage.preprod.antadis.fr/www/{log,upload} \\
|
||||||
|
&& chown -R www-data:www-data www/* \\
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Sync complete !!"
|
||||||
|
|
||||||
printf "Replacing shop names\n"
|
|
||||||
sed -i -e 's/chocolatdemariage.local/chocolatdemariage.preprod.antadis.fr/g' chocolatdemariage.sql
|
|
||||||
|
|
||||||
printf "Sending the Database dump to the preprod server"
|
|
||||||
PORT="4096"
|
|
||||||
rsync -e "ssh -p$PORT" -az ./chocolatdemariage.sql root@chocolatdemariage.preprod.antadis.fr:/home/www/chocolatdemariage.preprod.antadis.fr
|
|
||||||
printf "Sending complete\n"
|
|
||||||
|
|
||||||
#printf "importing the Database on the preprod server\n"
|
|
||||||
ssh root@chocolatdemariage.preprod.antadis.fr -p4096 "cd /home/www/chocolatdemariage.preprod.antadis.fr \\
|
|
||||||
&& git pull origin master \\
|
|
||||||
&& mysql -u chocolatdemariage -pantadis78 chocolatdemariage < chocolatdemariage.sql \\
|
|
||||||
&& if [ -f /home/www/chocolatdemariage.preprod.antadis.fr/www/cache/class_index.php ] ; then rm /home/www/chocolatdemariage.preprod.antadis.fr/www/cache/class_index.php ; fi \\
|
|
||||||
&& mkdir -p /home/www/chocolatdemariage.preprod.antadis.fr/www/{log,upload} \\
|
|
||||||
&& chown -R www-data:www-data www/* \\
|
|
||||||
"
|
|
||||||
printf "Sync complete !! \n"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user