polarson # ROMANIA 4 Posted June 4, 2014 Share Posted June 4, 2014 Un mic script bash pentru backup la bazele de date MySQL: #!/bin/sh# Backup Baze de date MySQLb_dir="/usr/BACKUP/"log_dir="/var/log/backup/"MySQL_db_dir="/usr/local/mysql/var/"MySQK_bk_user="userul de backup"MySQL_bk_pw="Parola pentru userul de backup"mkdir $b_dir`date +"%d%b%y"`mkdir $b_dir`date +"%d%b%y"`/mysql/# MySQLfor i in `ls $MySQL_db_dir | sed -e 's/\///'` ; doif [ -d $MySQL_db_dir$i ] ; thencd $b_dir`date +"%d%b%y"`/mysql//usr/bin/mysqldump $i -u $MySQL_bk_user -p"$MySQL_bk_pw" > $i-`date +"%d%b%y"`.sqltar cjf $i-`date +"%d%b%y"`.sql.tar.bz2 $i-`date +"%d%b%y"`.sqlrm -rf $i-`date +"%d%b%y"`.sqlfidone DOWNLOAD SCRIPT Job done. Enjoy! Link to comment Share on other sites More sharing options...
Recommended Posts