博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
系统升级shell
阅读量:6703 次
发布时间:2019-06-25

本文共 4275 字,大约阅读时间需要 14 分钟。

1 #!/bin/sh  2 #3.0.2.2->  3   4 updatefiledir=$1 #/home/temp  5 tomcatdir=$2    #/home/eduyun/eduyun  6   7   8   9  10 backup="/home/eduyunbackup/$(date +%Y%m%d%H%M)" 11  12 if [ ! -d $backup ]; then 13    mkdir -p $backup 14 fi 15  16 logfile=$backup"/update.log" 17  18 echo "shell input value1="$1 >> $logfile 19 echo "shell input value2="$2 >> $logfile 20  21 if [ "$updatefiledir" =  "" ]; then 22  echo "shell input is null,shell exit" >> $logfile 23  exit 0 24 fi 25  26 if [ "$tomcatdir" =  "" ]; then 27  echo "shell input is null,shell exit" >> $logfile 28  29  exit 0 30  31 fi 32  33 echo "start update ,stop sevices">> $logfile 34  35 kill -9 `ps -A  | grep svr_timer.sh | awk '{print $1}'` 36 kill -9 $(pidof java) 37 echo "stoped tomcat ">>$logfile 38  39 #update tomcat 40 if [  -d "$updatefiledir/tomcat" ]; then 41        echo "tomcat need update,begin to update">>$logfile 42         #tomcat exist  update tomcat 43         mkdir -p $backup/eduyunbak 44     cp -rf $tomcatdir/*   $backup/eduyunbak 45        echo "$tomcatdir backup finish">>$logfile 46         rm -r $tomcatdir/* 47         echo "delete $tomcatdir">>$logfile 48     cp -rf $updatefiledir/tomcat/*  $tomcatdir/ 49         echo "tomcat update finish...........">>$logfile 50         cp -rf $backup/eduyunbak/webapps/*  $tomcatdir/webapps/ 51      echo "chmod tomcat shell...........">>$logfile 52      chmod 777 $tomcatdir/bin/*.sh      53      if [  -d "$tomcatdir/jre" ]; then 54          chmod 777 $tomcatdir/jre/bin/*  55      fi 56 fi 57  58 #delete /home/eduyun/eduyun/webapps/ROOT/WEB-INF/lib/* 59 rm -rf $tomcatdir/webapps/ROOT/WEB-INF/lib/* 60  61 #update ROOT 62 if [  -d "$updatefiledir/ROOT" ]; then 63  64      echo "eduyun-java need to  update,begin to update">>$logfile 65         #ROOT  exist  update tomcat 66         cp -rf $updatefiledir/ROOT/*  $tomcatdir/webapps/ROOT/ 67         #copy libso 68  69         #cp -rf $tomcatdir/webapps/ROOT/WEB-INF/classes/libso/centercontrol/linux/*  /usr/lib/ 70         #chmod -R 777 /usr/lib/*.bin 71         #chmod -R 777 /usr/lib/ffserver 72         #cp -rf /usr/lib/servercnfg.xml /usr/etc/servercnfg.xml 73  74 fi 75  76 #update /usr/etc/servercnfg.xml 77  if [ -d "/usr/etc" ];then 78     echo "update /usr/etc/servercnfg.xml">>$logfile 79     if [ $(getconf WORD_BIT) = '32' ] && [ $(getconf LONG_BIT) = '64' ] ; then 80         if [ ! `grep "cc1path" /usr/etc/servercnfg.xml` ];then 81             sed -i '11i 
/home/eduyun/eduyun/webapps/ROOT/WEB-INF/classes/libso/centercontrol/linux/x64
' /usr/etc/servercnfg.xml 82 else 83 sed -i 's!
/usr/lib
!
/home/eduyun/eduyun/webapps/ROOT/WEB-INF/classes/libso/centercontrol/linux/x64
!g' /usr/etc/servercnfg.xml 84 fi 85 else 86 if [ ! `grep "cc1path" /usr/etc/servercnfg.xml` ];then 87 sed -i '11i
/home/eduyun/eduyun/webapps/ROOT/WEB-INF/classes/libso/centercontrol/linux/x86
' /usr/etc/servercnfg.xml 88 else 89 sed -i 's!
/usr/lib
!
/home/eduyun/eduyun/webapps/ROOT/WEB-INF/classes/libso/centercontrol/linux/x86
!g' /usr/etc/servercnfg.xml 90 fi 91 92 fi 93 94 95 fi 96 97 #update /etc/environment 98 if [ -d "/etc" ];then 99 echo "update /etc/environment">>$logfile100 if [ $(getconf WORD_BIT) = '32' ] && [ $(getconf LONG_BIT) = '64' ] ; then101 sed -i 's!/convert/linux!/centercontrol/linux/x64!g' /etc/environment102 if [ ! `grep "RECSVR_APP_PATH" /etc/environment` ];then103 echo 'RECSVR_APP_PATH="/home/eduyun/eduyun/webapps/ROOT/WEB-INF/classes/libso/centercontrol/linux/x64"'>>/etc/environment104 fi105 else106 sed -i 's!/convert/linux!/centercontrol/linux/x86!g' /etc/environment107 if [ ! `grep "RECSVR_APP_PATH" /etc/environment` ];then108 echo 'RECSVR_APP_PATH="/home/eduyun/eduyun/webapps/ROOT/WEB-INF/classes/libso/centercontrol/linux/x86"'>>/etc/environment109 fi110 fi111 fi112 113 114 115 116 117 echo "update completed ,start tomcat ">>$logspath$logfile118 119 120 121 sudo reboot122 #cd $tomcatdir/bin123 #./svr_timer.sh &

 

转载于:https://www.cnblogs.com/againn/p/8873496.html

你可能感兴趣的文章
ZOJ 2562 More Divisors(高合成数)
查看>>
[原]Android打包之跨平台打包
查看>>
C++的try_catch异常
查看>>
(转)思考:矩阵及变换,以及矩阵在DirectX和OpenGL中的运用问题:左乘/右乘,行优先/列优先,......
查看>>
HDU1452:Happy 2004(求因子和+分解质因子+逆元)上一题的简单版
查看>>
获取MSSQL Server中的相关信息(视图、存储过程、触发器、表)
查看>>
信号处理过程中的几种常见傅里叶相关的变换
查看>>
[原创] Win7全自动精简批处理_绝对原创,绝对给力_感谢无忧给了我一年的潜水...
查看>>
2017 年热门编程语言排行榜,你的语言上榜没?
查看>>
poi 合并单元格、设置边框
查看>>
Hibernate延迟加载与opensessioninviewFilter
查看>>
Atitit 图像处理 调用opencv 通过java api attilax总结
查看>>
服务管理--systemctl命令
查看>>
SQLServer 维护脚本分享(09)相关文件读取
查看>>
Winscp开源的SSH|SFTP
查看>>
闪回之 回收站、Flashback Drop (table、index、trigger等)
查看>>
office-word去掉效验红色的波浪线
查看>>
Struts2之Action与配置文件
查看>>
POJ 3278 Catch That Cow(BFS,板子题)
查看>>
在Winform开发中使用FastReport创建报表
查看>>