#!/bin/bash
dir_wwwbcgj168com=/data0/htdocs/
dir_wapbcgj168com=/data0/htdocs/wap.bcgj168.com/img/
dir_hongyunadmin=/data0/htdocs/
backupDir=/tmp/backup_dir
IP=110.173.51.163
date=`date +%Y%m%d-%H%M`
ftpUser=silidbbak
ftpPWD='falk*k2lLjdk752KDSLD'
file=`ls -t $backupDir |grep gz|sed -n '7,$p'`
for i in $file;do
rm -rf $backupDir/$i
done
if [[ ! -e $backupDir ]];then
mkdir -p $backupDir
fi
cd /data0/htdocs/ && tar czvf $backupDir/wwwbcgj168com_img-$IP-$date.tar.gz /data0/htdocs/
cd /data0/htdocs/wap.bcgj168.com/img/ && tar czvf $backupDir/wapbcgj168com_img-$IP-$date.tar.gz /data0/htdocs/wap.bcgj168.com/img/
cd /data0/htdocs/ && tar czvf $backupDir/hongyunadmin_img-$IP-$date.tar.gz /data0/htdocs/
#cd $backupDir
date0=`date +%Y%m%d`
cd $backupDir
/usr/bin/ftp -n<
open 110.173.49.242 21
user $ftpUser $ftpPWD
bin
#passive
mkdir $date0
cd $date0
#put mysql-$IP-$date.tar.gz
put wwwbcgj168com_img-$IP-$date.tar.gz
put wapbcgj168com_img-$IP-$date.tar.gz
put hongyunadmin_img-$IP-$date.tar.gz
#rm -rf wwwbcgj168com_img-$IP-$date.tar.gz
#rm -rf wapbcgj168com_img-$IP-$date.tar.gz
#rm -rf hongyunadmin_img-$IP-$date.tar.gz
#rm -rf $backupDir/*
bye
EOF
阅读(910) | 评论(0) | 转发(0) |