db_user="root"
db_passwd="xxx"db_host="localhost"databases="xxx-prod"
backup_dir="/backup/mysql_backup"
backip_test="/home/ttx/app/mysql_backup/today"
time="$(date +"%Y-%m-%d")"
test ! -w $backup_dir && echo "Error: $backup_dir is un-writeable." && exit 0
test ! -d "$backup_dir" && mkdir "$backup_dir"
for db in $databases
domv /backup/mysql_backup/wms_backup.gz /backup/mysql_backup/$db.$time.gzmysqldump -h $db_host $db | gzip -9 > "$backup_dir/wms_backup.gz"donefind $backup_dir -name "*.gz" -mtime +7 |xargs rm -rf
exit 0;