Company large version automatic update script
The company's large version is updated and is not universal.
#! / bin/bash# For large version update# Usage:. / script file.zip# Author by liu 2017-07-04PWD = `pwd`Web _ URL= "/ data/isonev45" FILE= "$1" IP= `ifconfig | sed-En's if 127.0.0.1 if. If (addr:)? ([0-9] *\.) {3} [0-9] *). * /\ 2 and p' `Chart [- z $1] Then echo-e "\ 033 [31mErrorJournal Please Usage: $0 web-xxxx.zip\ 033 [0m" exitfi# determines whether a large version of zip package contains if [!-f "$WEB_URL/$1"] Then # echo-e "\ 033 [31m =\ 033 [0m" echo-e "\ 033 [31m such file No such file!\ 033 [0m" # echo-e "\ 033 [31m =\ 033 [0m" exitfi# creates a large version to update the web directory function mkdir_web () {if [- d $WEB_URL/new_web] Then echo-e "\ 033 [31m [new _ web] directory is exist, please delete.\ 033 [0m" exit else mkdir $WEB_URL/new_web fi} # extract the large version update package function unzip_web () {file= `echo $FILE | awk-F [.]'{print $2} '`if [$file= = zip] Then unzip $WEB_URL/$FILE-d $WEB_URL/new_web # echo "zip" elif [$file = = tar] Then tar zxvf $WEB_URL/$FILE-C $WEB_URL/new_web # echo "tar" else echo-e "\ 033 [32mError There are no file types\ 033 [0m "fi # unzip $1-d new_web} # Delete the old configuration file NEW_CONF_DIR=" $WEB_URL/new_web/WEB-INF/classes "function del_conf () {# NEW_CONF_DIR=" $WEB_URL/new_web/WEB-INF/classes "cd $NEW_CONF_DIR & & rm-rf *. Conf pigeonTags.properties pigeon.lic & & cd. & &\ rm-rf Is1AppMarketContext.xml sessionContext.xml fulltextsearch.xml crontab.xml pigeonContext.xml IsoneSaasEngine.xml web.xml crontab_empty.xml IsoneJobsContext.xml} # copy the existing configuration file function copy_conf () {CONF_DIR= "$WEB_URL/web/WEB-INF/classes" cp $CONF_DIR/*.conf $NEW_CONF_DIR; cp $CONF_DIR/pigeon.lic $NEW_CONF_DIR; cp $CONF_DIR/pigeonTags.properties $NEW_CONF_DIR Cd $CONF_DIR/.. & & cp Is1AppMarketContext.xml sessionContext.xml fulltextsearch.xml crontab.xml pigeonContext.xml IsoneSaasEngine.xml web.xml IsoneJobsContext.xml $WEB_URL/new_web/WEB-INF/.} # close tomcatfunction stop_tomcat () {PID= `ps-ef | grep java | grep isonev45 | awk'{print $2} '`kill-9$ PID} # back up the original web and upgrade webDATE= `date +% Y% m% d`function install_web () {cd $WEB_URL; mv web web$DATE Mv new_web web} # launch tomcatfunction start_tomcat () {$WEB_URL/apache-tomcat-7.0.32/bin/startup.sh} # startup function, update mkdir_webunzip_webdel_confcopy_confstop_tomcatinstall_webstart_tomcatif [$?-eq 0]; then echo echo-e "\ 033 [32m update complete, please visit http://$IP Test\ 033 [0m" echofi