Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- USER="root"
- PASSWORD="Password_Aqui"
- UNIDAD_REMOTA=/mnt/nas
- DIR_TEMP=/root/respaldomysql/
- echo Db Variables OK!
- cd $DIR_TEMP
- #Empieza a sacar respaldos
- databases=`mysql -u $USER -p$PASSWORD -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`
- for db in $databases; do
- if [[ "$db" != "information_schema" ]] && [[ "$db" != "performance_schema" ]] && [[ "$db" != "mysql" ]] && [[ "$db" != _* ]] ; then
- echo "Dumping database: $db"
- mysqldump --defaults-file=/root/.udb.cnf --user $USER --databases $db > `date +%Y%m%d`.$db.sql
- echo Dbs Exportadas!
- gzip $OUTPUT/`date +%Y%m%d`.$db.sql
- echo y Comprimidos!
- fi
- done
- #TerminaDeHacerRespaldos
- mount 192.168.10.29:/volume1/EPMAPASD_BDDS $UNIDAD_REMOTA
- echo Unidad montada!
- mv *.gz $UNIDAD_REMOTA/SEGPRO/
- echo Copiado a unidad remota!
- umount $UNIDAD_REMOTA
- echo Desmontado!
- rm -rf $DIR_TEMP*.gz
- echo Carpeta temporal limpia!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement