forked from xuyu23681/LinuxShell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy_war(1).sh
27 lines (25 loc) · 1.05 KB
/
deploy_war(1).sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
direc=`dirname $0`
function check(){
count=`ps -ef |grep tomcat |grep -v "grep" |wc -l`
rmwar=`rm -rf /app/tomcat/webapps/*`
cpportal=`cp /wartest/portal.war /app/tomcat/webapps/`
starttomcat=`/app/tomcat/bin/startup.sh`
shutdowntomcat=`ps -ef|grep tomcat |grep -v grep|cut -c 9-15|xargs kill -9`
if [ $count -eq 0 ];then
$rmwar
$cpportal
[ $? -eq 0 ] && echo "copy portal.war success"|| echo "copy portal.war failure" && exit 1
$starttomcat
[ $? -eq 0 ] && echo "Tomcat direct start,This is a great script, and its author is Yang Bo" || echo "Tomcat direct start is failure" && exit 1
else
$shutdowntomcat
[ $? -eq 0 ] && echo "tomcat shutdown success"|| echo "tomcat shutdown failure" && exit 1
$rmwar
$cpportal
[ $? -eq 0 ] && echo "copy portal.war success"|| echo "copy portal.war failure" && exit 1
$starttomcat
[ $? -eq 0 ] && echo "Tomcat is the first to turn off after the start,This is a great script, and its author is Yang Bo" || echo "Tomcat is the first to turn off after the start of the failure" && exit 1
fi
}
check