#!/bin/bash
dbname=db
backpath=/home/mysqlbak/
dump=/data/bin/mysqldump
dbpass=xxxxxxxxx
date=`date +%y%m%d%H%M`
${dump} --opt -uroot -p${dbpass} ${dbname} | gzip > ${backpath}"hk"${dbname}"-"${date}.gz
find ${backpath} -mtime +2 -exec rm -rf {} \;
ftp -n <<!
open  1.1.1.1
user user  password
binary
prompt off
cd /home/mysqlbak
lcd /home/mysqlbak
put "hk"${dbname}"-"${date}.gz
close
bye
!