上线需要发布2个地方:
1、nginx_static 1台
2、frontier-cms-web 3台
和线上的服务器是通过跳板机通信的。
env文件是环境部署文件,格式为#ip=war;
cat copy_h5_mall_new.sh
#!/bin/sh
#copy h5 mall
nginx_static_ip=10.10.13.37
time_stamp=`date +"%Y-%m-%d-%H-%M-%S"`
h5_mall_zip_name=$1
war_md5=`md5sum ../static/${h5_mall_zip_name} | awk ‘{print $1}‘`
md5_file=`cat ../static/${h5_mall_zip_name}.md5 | awk ‘{print $1}‘`
if [ "${war_md5}" = "${md5_file}" ];then
ssh ${nginx_static_ip} "cp -r /data/desheng/h5_mall /data/desheng/h5_mall-${time_stamp}"
ssh ${nginx_static_ip} "cd /data/desheng/h5_mall && /bin/rm -rf *"
scp ../static/${h5_mall_zip_name} ${nginx_static_ip}:/data/desheng/h5_mall
ssh ${nginx_static_ip} "cd /data/desheng/h5_mall && unzip ${h5_mall_zip_name}"
ip_list=`cat ../env.sh | grep "frontier-cms-web" | cut -d "=" -f1 | cut -d "#" -f2 | uniq`
for ip in ${ip_list[*]};do
scp ../static/${h5_mall_zip_name} $ip:/data/
ssh $ip "cd /data/static/10 && cp -r h5_mall h5_mall-${time_stamp}"
ssh $ip "cd /data/static/10/h5_mall && /bin/rm -rf *"
ssh $ip "mv /data/${h5_mall_zip_name} /data/static/10/h5_mall;cd /data/static/10/h5_mall && unzip ${h5_mall_zip_name}"
done
fi本文出自 “LINUX Super梦” 博客,请务必保留此出处http://215687833.blog.51cto.com/6724358/1896659
原文:http://215687833.blog.51cto.com/6724358/1896659