#!/bin/bash
# code by yehuiming of beihai365
# 2010/9/26 18:05
day=`date +%Y.%m.%d`
rootdir="/data/backup"
cd $rootdir
mysqldump -x --all-databases -u backup -p4565fhvddds > "$day"_alldatabase.sql
gzip -f "$day"_alldatabase.sql > /dev/null 2>&1
cp -a /data/html ./
tar zcvf "$day"_html.tar.gz html > /dev/null 2>&1
host="192.168.1.243"
id="backup"
pw='gfdfg345345dfg'
ftp -n "$host" <<EOF
user $id $pw
binary
put "$day"_html.tar.gz all_coder.tar.gz
put "$day"_alldatabase.sql.gz all_database.sql.gz
EOF