diff options
Diffstat (limited to 'bin/sync/sync-wiki.sh')
-rwxr-xr-x | bin/sync/sync-wiki.sh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/bin/sync/sync-wiki.sh b/bin/sync/sync-wiki.sh new file mode 100755 index 00000000..0abf5a8a --- /dev/null +++ b/bin/sync/sync-wiki.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# ---- +# Copyright (C) 2013-2020 - Reevo Project (http://reevo.org) +# License: Affero GPL version 3 - http://www.gnu.org/licenses/agpl.html +# ES: Este archivos es parte de: reevo-web (http://git.reevo.org/reevo/reevo-web) +# EN: This file is part of: reevo-web (http://git.reevo.org/reevo/reevo-web) +# ---- + +REMOTO="reevo.red" + +RUTA=`cat ../../etc/global_config.php | grep '^$REEVO_PATH' | cut -d '"' -f 2` +DOMINIO=`cat $RUTA/etc/global_config.php | grep '^$REEVO_URL' | cut -d '"' -f 2` +USER=`cat $RUTA/etc/global_config.php | grep '^$REEVO_DB_USER' | cut -d '"' -f 2` +PASSWORD=`cat $RUTA/etc/global_config.php | grep '^$REEVO_DB_PASS' | cut -d '"' -f 2` + +DB=`cat $RUTA/etc/global_config.php | grep '^$REEVO_DB_WIKI' | cut -d '"' -f 2` +TIMESTAMP=`date +%Y-%m-%d-%H:%M:%S` + + +echo "Vamos a sincronizar la BD y archivos desde $REMOTO hasta aqui $DOMINIO. Presione ENTER para continuar o cancele..." +read + +echo "" +echo "###################" +echo "Hacemos un backup de la base de datos que tenemos en este servidor" +../bkp/bkp_wiki.sh + +echo "" +echo "###################" +echo "Generamos una copia de la BD en el servidor remoto" +ssh $REMOTO "$RUTA/bin/bkp/bkp_wiki.sh" + +echo "" +echo "Copiamos la BD desde el servidor hasta aqui" +scp "$REMOTO:$RUTA/bkp/wiki/ultimo" "/tmp/$REMOTO-$DB.sql.bz2" + +echo "" +echo "Descomprimimos e importamos" +bunzip2 "/tmp/$REMOTO-$DB.sql.bz2" +# mysql --user=$USER --password=$PASSWORD -e "CREATE database if not exists $BDIMPORT;" +# mysql --user=$USER --password=$PASSWORD $DB < "/tmp/$REMOTO-$DB.sql" + +echo "" +echo "Borramos los temporales" +# rm "/tmp/$REMOTO-$DB.sql" + +# echo "" +# echo "ETAPA 2: Vamos a sincronizar algunos directorios con archivos..." +# sleep 2s +# rsync -P -r -a -v -e "ssh -l reevo" --delete beta.reevo.org:/srv/reevo.org/var/elgg/ /srv/dev/files/red/ |