标签:shell
[zyzx@ZYZX-DMZ-VIRTUAL-0005 chy]$ cat change.sh
#!/bin/bash
#yu
#
egrep -o "[[:alnum:]]{1,}/src*" a.txt | awk -F"/" ‘{print $1}‘ | sort -u
num=`egrep -o "[[:alnum:]]{1,}/src*" a.txt | awk -F"/" ‘{print $1}‘ | sort -u | wc -l`
echo "Total: $num"
[zyzx@ZYZX-DMZ-VIRTUAL-0005 chy]$ cat create.sh
#!/bin/bash
#yu
#
egrep -o "[[:alnum:]]{1,}/src*" a.txt | awk -F"/" ‘{print $1}‘ | sort -u
num=`egrep -o "[[:alnum:]]{1,}/src*" a.txt | awk -F"/" ‘{print $1}‘ | sort -u | wc -l`
echo "Total: $num"
egrep -o "[[:alnum:]]{1,}/src*" a.txt | awk -F"/" ‘{print $1}‘ | sort -u > b.txt
#create project
for i in `cat b.txt`;do
read -p "Are you sure create $i? " project
if [ $project = "yes" ];then
/home/zyzx/deploy_test/bin/create-$i.sh
else
echo "no need create $i."
fi
done
[zyzx@ZYZX-DMZ-VIRTUAL-0005 chy]$ cat deploy.sh
#!/bin/bash
#yu
#
Date="============`date +%Y%m%d_%H%M`============"
egrep -o "[[:alnum:]]{1,}/src*" a.txt | awk -F"/" ‘{print $1}‘ | sort -u
num=`egrep -o "[[:alnum:]]{1,}/src*" a.txt | awk -F"/" ‘{print $1}‘ | sort -u | wc -l`
echo "Total: $num"
egrep -o "[[:alnum:]]{1,}/src*" a.txt | awk -F"/" ‘{print $1}‘ | sort -u > b.txt
#deploy project
echo $Date > deploy.log
for i in `cat b.txt`;do
read -p "Are you sure deploy $i? " deploy
deploylog () {
echo `cat /home/zyzx/deploy_test/bin/log/deploy-$i.log` >> deploy.log
}
if [ $deploy = "yes" ];then
cd /home/zyzx/deploy_test/bin/
sh deploy-$i.sh
deploylog
elif [ $deploy = "esb_in" ];then
cd /home/zyzx/deploy_test/bin/
sh deploy-$i-in.sh
echo `cat /home/zyzx/deploy_test/bin/log/deploy-esb-in.log` >> deploy.log
elif [ $deploy = "esb_out" ];then
cd /home/zyzx/deploy_test/bin/
sh deploy-$i-out.sh
echo `cat /home/zyzx/deploy_test/bin/log/deploy-esb-out.log` >> deploy.log
else
echo "no need deploy"
fi
done
more /tmp/chy/deploy.log
[zyzx@ZYZX-DMZ-VIRTUAL-0005 chy]$
[zyzx@ZYZX-DMZ-VIRTUAL-0005 chy]$ cat rmlog.sh
#!/bin/bash
#yu
#
for i in `cat d.txt`;do
find /home/zyzx/$i/logs/ -mtime +10 -exec rm -rf {} \;
done
[zyzx@ZYZX-DMZ-VIRTUAL-0005 chy]$
标签:shell
原文地址:http://anyulinux.blog.51cto.com/9108882/1695585