Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2755903
  • 博文数量: 587
  • 博客积分: 6356
  • 博客等级: 准将
  • 技术积分: 6410
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-23 10:54
个人简介

器量大者,福泽必厚

文章分类

全部博文(587)

文章存档

2019年(3)

2018年(1)

2017年(29)

2016年(39)

2015年(66)

2014年(117)

2013年(136)

2012年(58)

2011年(34)

2010年(50)

2009年(38)

2008年(16)

分类: LINUX

2011-11-28 11:05:35

香港的机制修改了!

备份下原来的脚本

只为自己工作只用!

#!/bin/bash
HOST_IP=`/sbin/ifconfig eth0 | grep *.*.* |awk '{print $2}'|awk -F: '{print $2}'`
Target_Path=/usr/Backup_web_mount_point
Vhost_date=`date +%Y%m%d`
Backup_date=`date +%y%m`
Delete_date=`date --date "7 days ago" +"%Y%m%d"`
vhost_dir1=/usr/local/xncenter/confcenter
vhost_dir2=/usr/local/xncenter/confcenter/scripts/backup_web_scripts
mkdir -p $Target_Path/$HOST_IP-alldomain/$Vhost_date
rm   -fr $Target_Path/$HOST_IP-alldomain/${Delete_date}
Backup_full_path=$Target_Path/$HOST_IP-alldomain/$Vhost_date

sleep 10
#
##############################
###Find vhost.conf File domain name.
#
if [  -e domain_names.txt ];then
rm -rf domain_names.txt
fi
#
cat  $vhost_dir1/vhost.conf  | grep 'ServerName www'| sort -nr | uniq -c | sort -nr> $vhost_dir2/domain_names.txt
Domain_Capture=`awk '{print $3}' $vhost_dir2/domain_names.txt`
#
#
if [  -e full_domain_name.txt ];then
rm -rf full_domain_name.txt
fi
for i in ${Domain_Capture}
do
#sleep 1
cd $vhost_dir2
echo $i >> full_domain_name.txt
done
#
rm -rf domain_names.txt
##
##
Ip_only=`echo $HOST_IP |cut -d . -f4`

if [  -e world_domain_list-$Ip_only.txt ];then
rm -rf world_domain_list-$Ip_only.txt
fi
#
SUB=`cat full_domain_name.txt`
for f in ${SUB}
do
expr "$f" : '[^\.]*\.\(.*\)' >> world_domain_list-$Ip_only.txt
done
rm -rf full_domain_name.txt
sleep 10
#
#
#####
################################
##################
##Compressed backup of the corresponding domain name website
##
#
cd $vhost_dir2
domain_list=`cat $vhost_dir2/world_domain_list-$Ip_only.txt`
#
#
for var in ${domain_list}
do
sleep 1
a=`echo $var|cut -c 1`
b=`echo $var|cut -c 2`
c=`echo $var|cut -c 3`
cd /usr/vhome/${a}/${b}/${c}/${var}
#Backup data
tar -zcvf $Backup_full_path/$HOST_IP-${var}-$Vhost_date.tar.gz ./*
done
cd /usr/local/xncenter
tar -zcvf $Backup_full_path/confcenter-${HOST_IP}-${Vhost_date}.tar.gz  ./confcenter
 
ftp -n 10.7.2.6 >error 2>&1 <user linuxweb linuxweb
bin
prompt
cd /*.*.*.*/web
mkdir $Vhost_date
cd /*.*.*.*/web/$Vhost_date
lcd $Backup_full_path
mput  *
bye
EOC

阅读(1194) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~