静态文件发布脚本实例

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了静态文件发布脚本实例相关的知识,希望对你有一定的参考价值。



上线需要发布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

以上是关于静态文件发布脚本实例的主要内容,如果未能解决你的问题,请参考以下文章

片段之间的静态 ArrayList

支持动态或静态片段的不同屏幕尺寸?

静态文件发布脚本实例

片段内部静态类和gradle问题

创建片段而不从 java 代码实例化它

片段事务中的实例化错误