上线需要发布2个地方:
1、nginx_static 1台
2、frontier-cms-web 3台
和线上的服务器是通过跳板机通信的。
env文件是环境部署文件,格式为#ip=war;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
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
|
本文转自青衫解衣 51CTO博客,原文链接:http://blog.51cto.com/215687833/1896659