A shell script for an automated deployment

Source: Internet
Author: User

Tag:conf    start failure     Path    kill   jar    web    automation    history   webapps   

#!/bin/bash### #just for autodeploy## #author: zgniu######## #定义项目路径 ######## #item_war_dir = "/home/v2/tomcat8080/ Webapps/server-mobile-web "######## #定义项目配置文件路径 ######## #item_conf_dir ="/home/v2/tomcat8080/webapps/ Server-mobile-web/web-inf/classes "######## #定义历史配置文件路径 ######## #history_conf_dir ="/home/backupfile/ Server-mobile-web "######## #定义tomcat启动路径 ######## #tomcat_bin_dir ="/home/v2/tomcat8080/bin "######## #定义项目名称 ####### # #item_name = "Server-mobile-web.war" ######## #定义进程名称 ######## #instance_name = "tomcat8080" ######## #项目地址 ######### Item_url= "http://localhost:8080" ######## #项目日志路径 ######## #item_log_dir = "/home/v2/tomcat8080/logs" ######### Define project backup specific time to seconds ######## #datetime = ' Date +%y-%m-%d ' ######## #开始kkill tomcat process ######## #ps aux | grep ${instance_name} | Grep-v grep | awk ' {print ' kill-9 ", $2|" Bash "} ' ######## #检查进程是否存在 #########" flageid=$ (ps aux | grep $instance _name | grep-v grep) ######## #不存在执行如下操作 ######### "if [["$FLAGEID" = = ""]];then # CD ${item_war_dir} # JAR-XVF ${item_name} #sleep 6 Cp-rF ${history_conf_dir}_backup${datetime}/web-inf/classes/* ${item_conf_dir}sleep 3 CD ${tomcat_bin_dir}./st artup.sh######## #否则再次执行kill进程 ######### "elseps aux | grep ${instance_name} | Grep-v grep | awk ' {print ' kill-9 ", $2|" Bash "} ' fisleep 5######## #检查是否启动成功 #########" CD ${item_log_dir}tail-f catalina-20${datetime}.out ########### #curl ${ item_url}## #if [$?-eq 0]; then###### echo-e "\n################################# #恭喜你, Project startup Success ##################################\n" # # # # # # # # #else # ##### echo-e "\n########################### #很遗憾, Project failed to start, please check ############################\n manually" fi###############

  

A shell script for an automated deployment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.