- 浏览: 53387 次
- 性别:
- 来自: 北京
-
文章分类
最新评论
#!/bin/bash
sp="/home/script"
spt=$sp/tmp
sptt=$sp/tmp/
sps=$sp/src
if [ -d ${sp} ];then
if [ -d ${sps} ]&&[ -d ${spt} ];then
echo "${sps}&&${spt} is exist."
else
mkdir -p ${sp}/tmp
mkdir -p ${sp}/src
sp="/home/script"
spt=$sp/tmp
sptt=$sp/tmp/
sps=$sp/src
if [ -d ${sp} ];then
if [ -d ${sps} ]&&[ -d ${spt} ];then
echo "${sps}&&${spt} is exist."
else
mkdir -p ${sp}/tmp
mkdir -p ${sp}/src
fi
else
mkdir -p ${sp}
mkdir -p ${sp}/tmp
mkdir -p ${sp}/src
fi
cd $sps
wget http://www.lbase.net/Download/IPInfo-CN-UNICOM"("CNC")".txt
wget http://www.lbase.net/Download/IPInfo-CN-ChinaTelcom.txt
wget http://www.lbase.net/Download/IPInfo-CN-CTT.txt
wget http://www.lbase.net/Download/IPInfo-CN-ChinaMobile.txt
file=$(ls $sps)
for f in $file;do
x=$(ls $f | awk -F '-' '{print $3}' | awk -F '.' '{print $1}')
case $x in
ChinaMobile)
sed '/^\;/d' $f > $spt/mobile
;;
ChinaTelcom)
sed '/^\;/d' $f > $spt/telcom
;;
CTT)
sed '/^\;/d' $f > $spt/ctt
;;
UNICOM\(CNC\))
sed '/^\;/d' $f > $spt/unicom
;;
esac
done
para=$(rpm -qa | grep dos2unix)
echo $para
if [ ! -n $para ]; then
echo "dos2unix hasn't installed on this server."
yum -y install dos2unix
else
echo "dos2unix has installed on this server."
fi
file1=$(ls $spt)
cd $spt
echo "converting started"
for x in $file1;do
echo "convert ${sptt}${x}"
dos2unix $sptt$x
done
echo "converting finished"
data="/usr/local/named/data/ip"
if [ ! -d $data ];then
mkdir -p $data
fi
cd $data
file2=$(ls $spt)
y=$(date -d "today" +"%Y")
m=$(date -d "today" +"%m")
d=$(date -d "today" +"%d")
time=$(date |awk '{print $5}')
for i in $file2;do
ipfile="${i}.ip"
if [ -f $ipfile ];then
echo "${ipfile} is exist."
emts=$(cat $sptt$i)
for e in $emts;do
t=$(cat $ipfile | grep $e)
if [[ -z $t ]];then
sed -i '/};/ i\'$e'\;' $ipfile
echo "${y}-${m}-${d} ${time} ipaddress $e inserted in ${ipfile}" >> /var/log/named-update.log
echo "${y}-${m}-${d} ${time} ipaddress $e inserted in ${ipfile}" >> $sp/mail
# else
# echo "${e} had in ${ipfile} list"
fi
done
else
touch "${ipfile}"
echo "acl ${i}{" > $ipfile
echo "};" >> $ipfile
emts=$(cat $sptt$i)
for e in $emts;do
sed -i '/};/ i\'$e'\;' $ipfile
echo "${y}-${m}-${d} ${time} ipaddress $e inserted in ${ipfile}" >> /var/log/named-update.log
#echo "ipaddress $e inserted in ${ipfile}"
echo "${y}-${m}-${d} ${time} ipaddress $e inserted in ${ipfile}" >> $sp/mail
done
fi
done
if [ -f $sp/mail ];then
con=$(cat $sp/mail)
/usr/sbin/sendmail -t <<EOF
From: zone update <root@localhost>
To:yang.liu@91nbs.com;shiyu.xu@91nbs.com
Subject: zone update
$con
EOF
rm -rf $sp/mail
fi
rm -rf $spt $sps
rndc reload
sp="/home/script"
spt=$sp/tmp
sptt=$sp/tmp/
sps=$sp/src
if [ -d ${sp} ];then
if [ -d ${sps} ]&&[ -d ${spt} ];then
echo "${sps}&&${spt} is exist."
else
mkdir -p ${sp}/tmp
mkdir -p ${sp}/src
sp="/home/script"
spt=$sp/tmp
sptt=$sp/tmp/
sps=$sp/src
if [ -d ${sp} ];then
if [ -d ${sps} ]&&[ -d ${spt} ];then
echo "${sps}&&${spt} is exist."
else
mkdir -p ${sp}/tmp
mkdir -p ${sp}/src
fi
else
mkdir -p ${sp}
mkdir -p ${sp}/tmp
mkdir -p ${sp}/src
fi
cd $sps
wget http://www.lbase.net/Download/IPInfo-CN-UNICOM"("CNC")".txt
wget http://www.lbase.net/Download/IPInfo-CN-ChinaTelcom.txt
wget http://www.lbase.net/Download/IPInfo-CN-CTT.txt
wget http://www.lbase.net/Download/IPInfo-CN-ChinaMobile.txt
file=$(ls $sps)
for f in $file;do
x=$(ls $f | awk -F '-' '{print $3}' | awk -F '.' '{print $1}')
case $x in
ChinaMobile)
sed '/^\;/d' $f > $spt/mobile
;;
ChinaTelcom)
sed '/^\;/d' $f > $spt/telcom
;;
CTT)
sed '/^\;/d' $f > $spt/ctt
;;
UNICOM\(CNC\))
sed '/^\;/d' $f > $spt/unicom
;;
esac
done
para=$(rpm -qa | grep dos2unix)
echo $para
if [ ! -n $para ]; then
echo "dos2unix hasn't installed on this server."
yum -y install dos2unix
else
echo "dos2unix has installed on this server."
fi
file1=$(ls $spt)
cd $spt
echo "converting started"
for x in $file1;do
echo "convert ${sptt}${x}"
dos2unix $sptt$x
done
echo "converting finished"
data="/usr/local/named/data/ip"
if [ ! -d $data ];then
mkdir -p $data
fi
cd $data
file2=$(ls $spt)
y=$(date -d "today" +"%Y")
m=$(date -d "today" +"%m")
d=$(date -d "today" +"%d")
time=$(date |awk '{print $5}')
for i in $file2;do
ipfile="${i}.ip"
if [ -f $ipfile ];then
echo "${ipfile} is exist."
emts=$(cat $sptt$i)
for e in $emts;do
t=$(cat $ipfile | grep $e)
if [[ -z $t ]];then
sed -i '/};/ i\'$e'\;' $ipfile
echo "${y}-${m}-${d} ${time} ipaddress $e inserted in ${ipfile}" >> /var/log/named-update.log
echo "${y}-${m}-${d} ${time} ipaddress $e inserted in ${ipfile}" >> $sp/mail
# else
# echo "${e} had in ${ipfile} list"
fi
done
else
touch "${ipfile}"
echo "acl ${i}{" > $ipfile
echo "};" >> $ipfile
emts=$(cat $sptt$i)
for e in $emts;do
sed -i '/};/ i\'$e'\;' $ipfile
echo "${y}-${m}-${d} ${time} ipaddress $e inserted in ${ipfile}" >> /var/log/named-update.log
#echo "ipaddress $e inserted in ${ipfile}"
echo "${y}-${m}-${d} ${time} ipaddress $e inserted in ${ipfile}" >> $sp/mail
done
fi
done
if [ -f $sp/mail ];then
con=$(cat $sp/mail)
/usr/sbin/sendmail -t <<EOF
From: zone update <root@localhost>
To:yang.liu@91nbs.com;shiyu.xu@91nbs.com
Subject: zone update
$con
EOF
rm -rf $sp/mail
fi
rm -rf $spt $sps
rndc reload
发表评论
-
统计文件数量
2017-07-17 14:56 545#!/bin/bash ip=$1 user=administ ... -
sed实例
2016-03-17 14:03 326在b.txt的第2行之前插入“xxx” sed '2 ... -
SHELL基本命令备忘
2015-02-04 15:07 5371. 判断当前用户 if [ "$UID" ... -
rsync同步脚本
2014-10-21 17:26 587#!/bin/bash d=$(date -d "t ... -
填写cfg文件
2014-07-17 11:10 641#!/bin/bash x=$(cat /usr/local/ ... -
统计文件目录大小,文件个数
2014-06-26 10:54 654#!/bin/bash info="/home/sc ... -
shell kill
2014-02-28 16:42 435ps -ef | grep nagios.cfg | grep ... -
mysql添加删除用户
2013-10-09 16:47 407#!/bin/bash read -p "input ... -
linux基本配置
2013-09-18 15:24 525#!/bin/sh /etc/init.d/iptables ... -
shell更改网卡ip地址
2013-09-02 18:47 1139#!/bin/sh wk=$(ifconfig -a | ... -
添加用户
2013-08-26 16:38 443#!/bin/sh echo "输入用户名(可以 ... -
nginx统计1
2013-04-08 12:16 752#!/bin/bash logs_path="/ ... -
nginx统计
2013-04-08 12:14 734#!/bin/bash logs_path="/ ...
相关推荐
再把开发的工具和解压的全量更新文件以及导出的SVN更新日志放在同级目录,利用插件把SVN更新日志的增量更新文件提取生成同部署一致的目录结构更新文件。为提高增量更新的效率和减少文件更新错误提供了很大的帮助。
C# 提取目录中最新的更新文件 指定某个时间点后的文件
适用于Windows 8.1的Virtual PC 2007更新文件(包含32位和64位),加入了许多功能,需要的可以下载。
C# 比较提取更新文件源代码C# 比较提取更新文件源代码C# 比较提取更新文件源代码
FTP模式下载文件更新,只要配置下载路径、用户名和密码多线程下载文件,根据文件大小支持断点下载文件。更新完成后自动打开运行的exe文件(需要配置)
FX5U FX5UC的固件更新文件:序列号为“17X ”或更高版本,对于FX5UC-32MT DS-TS和FX5UC-32MT DSS-TS,序列号为“178 ”或更高版本
更新文件时间,文件时间修改器更新文件时间修改文件属性(创建时间、修改时间等属性) 修改文件属性(创建时间、修改时间等属性) 修改文件属性(创建时间、修改时间等属性)
pc-lint_9.0h->9.0i的更新文件, 包括patch文件, lnt文件。
判断serve上文件与本地文件的文件名和修改时间更新文件
文件更新下载的很好的案例之一,值得学习,为大家提供技术支持
而让运维人员去一个个找这些文件又太麻烦,因此写了该脚本,这样,开发人员只要把自己更新文件的路径放到配置文件中,运行脚本就会将这些文件下载到本地目录,最后将这些文件放到生产环境中去。
#如果是更新文件一行之中如果既有start,又有distinct则视为更新区域开始 start=start #如果是更新文件一行之中如果既有end,又有distinct则视为更新区域结束 end=end distinct=业务变更履历NoXX regex=null #处理...
解决uiautomatorviewer报错问题,分享给大家。 Unexpected error while obtaining UI hierarchy # 点击Details java.lang.reflect.InvocationTargetException
1.绿盟-更新工具(周一运行)-自动下载最新更新文件.vbs
delphi http xml 控制台自动更新文件
7620更新文件不是固件文件
TCPIP更新文件.rar
DirectX 9.0的最新更新文件,可以解决最新游戏无法运行的问题。32位系统与64位系统通用。 已在极品飞车14和黑手党2上测试通过。
LuckySheet 单元格更新文件
android assetsmanager 调用 OLUpdateFilesByHimi.zip