7
I rode the script
below, to perform backups of three Mysql bases. I would like to know if it is correct.
#VARIAVEIS
DATE=`date +%Y%m%d-%H%M`
HOSTNAME1="xxxxx"
HOSTNAME2="yyyyy"
HOSTNAME3="zzzzz"
USER='xyzedmar'
PASSWORD='xyz2'
DATABASE1='xxxxx'
DATABASE2='yyyyy'
DATABASE3='zzzzz'
DIR='http://site/mysql-bkp/'
#backup do banco de dados
mysqldump --host=$HOSTNAME1 --user=$USER --password=$PASSWORD --databases $DATABASE1 > $DIR/backup_$DATABASE1_$DATE.sql
mysqldump --host=$HOSTNAME2 --user=$USER --password=$PASSWORD --databases $DATABASE2 > $DIR/backup_$DATABASE2_$DATE.sql
mysqldump --host=$HOSTNAME3 --user=$USER --password=$PASSWORD --databases $DATABASE3 > $DIR/backup_$DATABASE3_$DATE.sql
But I need help to
1) how to delete files from x previous days, after made the updated backups?
2) What is the code Cron to rotate the script
?
Managed to solve your problem?
– durtto
No. I couldn’t adapt the code you suggested.
– Edmar Roberto Prandini
What couldn’t you do? Tried to run bash? Error? I use this code to back up my banks and it works perfectly
– abfurlan
My backup routines are all automated, whether by scripts, software, etc. Take a look at my comment on this thread that can help you with your implementation. http://answall.com/a/101888/21263 Hug
– Andre Mesquita
> You can use this Python script that I created, it backs up all databases. Download it, run a chmod +x backup_mysql.py and put in the folder /usr/local/bin/
– Nilton OS