#db_user="root"
#db_passwd=""
#db_host="localhost"
dir1="/home/lia/wcjh/d/"
dir2="/home/lia/wcjh/m/"
dir3="/home/lia/wcjh/y/"
dir4="/var/lib/mysql/"
dir5="/var/www/html/sfs3/data/"
# date format for backup file (yyyy-mm-dd)
time1="$(date +"%d")"
time2="$(date +"%Y%m%d")"
# mysql, mysqldump and some other bin's path
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
MKDIR="$(which mkdir)"
RM="$(which rm)"
MV="$(which mv)"
GZIP="$(which gzip)"
TAR="$(which tar)"
#DUMP="$(which dump)"
# check the directory for store backup is writeable
test ! -w $backup_dir && echo "Error: $backup_dir is un-writeable." && exit 0
##################################################################
mysqldump_s1="$($MYSQLDUMP -uroot -p'' wcjh > "$dir1""wcjh.sql")"
#1done: mysqldump wcjh > ../d/wcjh.sql (txt)
$mysqldump_s1
sleep 1
################################################################
tar_s1="$($TAR zcvf "$dir1""mysql.tar.gz" "$dir4")"
#done
$tar_s1
######################################################:wq############
tar_s2="$($TAR zcvf "$dir2$time1""wcjh.tar.gz" "$dir1""wcjh.sql")"
#3done:À£ÁY1done(txt) tar zcvf ../m/"date"wcjh.tar.gz ../d/wcjh.sql
$tar_s2
##################################################################
沒有留言:
張貼留言