#!/bin/bash# define on-line operation step ip= ' ifconfig | grep ' inet addr ' |grep 139|awk ' {print $2} ' |awk -f ': ' ' {print $2} ' date= ' date +%f ' s_dir= '/home/zwjfadmin001 ' LC_PID= ' PS aux |grep tomcat_lcApp |grep -v grep |awk ' {print $2} ' dk_pid= ' ps aux |grep tomcat_dkapp |grep -v grep |awk ' {print $2} ' DU_PID= ' ps aux |grep tomcat_dubbo |grep -v grep |awk ' {print $2} ' LCAD_ Pid= ' ps aux |grep tomcat_lcadmin |grep -v grep |awk ' {print $2} ' Tim_pid= ' ps aux |grep tomcat_timer |grep -v grep |awk ' {print $2} "echo $DATE # define Full volume release function full_lc {echo " ====================== Close your banking app ================= = = = "cd /opt/./tomcat_lcapp/bin/catalina.sh stopsleep 3kill -9 ${lc_pid}if [ "${lc_pid}" == "" ]; then echo "TOMCAT IS   STOPD" else echo "Tomcat is not stopd please check! " exit 0ficd tomcat_lcApp/onlineapp/rm -rf lcapp/*echo "Delete cache file" rm -rf /opt/tomcat_lcapp/temp/* /opt/tomcat_lcapp/work/catalina/ *echo "Start updating Files" unzip ${s_dir}/lcapp.war -d /opt/tomcat_lcapp/onlineapp/ lcappecho "================ update complete, start service ==================" cd /opt/./tomcat_lcapp/bin/catalina.sh startif [ "$?" == "0" ]; then echo "Boot success, check startup log" tail -f /opt/tomcat_ lcapp/logs/catalina.out else echo "Failed to start, please check service"      EXIT 0FI} #定义贷款全量发布function full_dk {echo "================== = = Close Loan Application ===================== "cd /opt/./tomcat_dkapp/bin/catalina.sh stopsleep 3kill -9 ${DK_PID}if [ "${dk_pid}" == "" ]; then echo "TOMCAT IS   STOPD" else echo "TOMCAT IS NOT  STOPD please check! " exit 0ficd tomcat_dkApp/onlineapp/rm -rf dkapp/*echo "Delete cache file" rm -rf /opt/tomcat_dkapp/temp/* /opt/tomcat_dkapp/work/catalina/ *echo "Start updating Files" unzip ${s_dir}/dkapp.war -d /opt/tomcat_dkapp/onlineapp/ dkappecho "================ update complete, start service ==================" cd /opt/./tomcat_dkapp/bin/catalina.sh startif [ "$?" == "0" ]; then echo "Start successfully, check startup log" tail -f /opt/tomcat_ dkapp/logs/catalina.out else echo "Failed to start, please check service"         EXIT 0FI} #定义dubbo全量更新function full_dubbo {echo "====================== off Dubbo app =====================" cd /opt/./tomcat_dubbo/bin/catalina.sh stopsleep 3kill -9 ${du_pid}if [ "${du_pid}" == "" ]; then echo "TOMCAT IS   STOPD" else echo "tomcat is not stopd please check!" exit 0ficd tomcat_dubbo/onlineapp/rm -rf dubbo1/*echo "Delete cache file" Rm -rf /opt/tomcat_dubbo/temp/* /opt/tomcat_dubbo/work/catalina/*echo "Start updating Files" unzip ${s_dir}/ dubbomainserver.war -d /opt/tomcat_dubbo/onlineapp/dubbo1echo "================ update complete, start service ===== ============= "cd /opt/./tomcat_dubbo/bin/catalina.sh startif [ " $? " == "0" ]; then echo "Start successfully, check startup log" tail -f /opt/tomcat_ dubbo/logs/catalina.out else echo "Failed to start, please check service" exit 0fi}function full_lcadmin {echo "====================== Close the financial background app ===================== "CD /OPT/./TOMCAt_lcadmin/bin/catalina.sh stopsleep 3kill -9 ${lcad_pid}if [ "${LCAD_PID}" == "" ]; then echo "TOMCAT IS   STOPD" else echo "Tomcat is not stopd please check! " exit 0ficd tomcat_lcadmin/onlineapp/rm -rf lcAdmin/*echo "Delete cache files" rm -rf /opt/tomcat_lcadmin/temp/* /opt/tomcat_lcadmin/ work/catalina/*echo "Start updating Files" unzip ${s_dir}/lcadmin.war -d /opt/tomcat_lcadmin/ onlineapp/lcadminecho "================ update complete, start service ==================" cd /opt/./tomcat_lcadmin/bin/ Catalina.sh startif [ "$?" == "0" ]; then echo "Start successfully, check startup log" tail -f /opt/tomcat_ lcadmin/logs/catalina.out else echo "Failed to start, please check service" exit 0fi}function full_timer {echo "====================== Turn off the timer application ===================== "cd /opt/./tomcat_timer/bin/catalina.sh stopsleep 3kill -9 ${TIM_PID}if [ "${tim_pid}" == "" ]; then echo "TomCAT IS   STOPD " else echo "tomcat is not stopd please check! " exit 0ficd tomcat_timer/onlineapp/rm -rf timer/*echo "Delete cache file" rm -rf /opt/tomcat_timer/temp/* /opt/tomcat_timer/work/catalina/ *echo "Start updating Files" unzip ${s_dir}/lctimer.war -d /opt/tomcat_lcadmin/onlineapp/ timerecho "================ update complete, start service ==================" cd /opt/./tomcat_timer/bin/catalina.sh startif [ "$?" == "0" ]; then echo "Start successfully, check startup log" tail -f /opt/tomcat_timer/logs/catalina.out else echo "Failed to start, please check service" exit 0fi}function full_dubbo2 {echo "====================== off Dubbo app =====================" cd /opt/./tomcat_dubbo2/bin/ catalina.sh stopsleep 3kill -9 ${du_pid}if [ "${DU_PID}" == "" ]; then echo "TOMCAT IS   STOPD" else echo "tomcat is not stopd please check!" exit 0ficd tomcat_dubbo2/onlineapp/rm -rf dubbo2/*echo "Delete cache file" rm -rf /opt/tomcat_dubbo2/temp/* /opt/tomcat_dubbo2/work/catalina/*echo "Start updating Files" unzip ${S_DIR}/dubboMainServer.war -d /opt/tomcat_dubbo2/onlineapp/dubbo2echo "================ Update complete, start service ================== "cd /opt/./tomcat_dubbo2/bin/catalina.sh startif [ " $? " == "0" ]; then echo "Start successfully, check startup log" tail -f /opt/tomcat_ dubbo2/logs/catalina.out else echo "Failed to start, please check service" exit 0fi}yd_bak;if [ "${ip}" == "139.196.153.10" ] then echo "Financial app pid is ${lc_pid}" echo "Loan pid is ${dk_pid}" echo "Dubbo pid is ${du_pid} " read -p "Please choese the update file: lcapp,dkapp , Dubbo " FILE case ${FILE} in &Nbsp; lcapp|lcapp) { full_lc };; dkapp|dkapp) { full_dk };;        DUBBO1|DUBBO) { full_dubbo };; *) echo "sorry! can not find ${FILE} or No such file " esac else echo "Dubbo pid is ${du_pid}" echo "Timer Pid is ${tim_pid}" echo "Financial background pid is ${lcad_pid} " read -p "Please choese the update file: lcadmin, Dubbo2,timer " FILE    &Nbsp; case ${file} in lcadmin) { full_lcadmin };;        DUBBO2) { full_dubbo2 };; timer) { full_timer };; *) echo "sorry! can not find ${FILE} or No such file " esacfi
Tomcat program Full volume update script