wendu 发表于 2018-11-12 07:35:25

tomcat+nginx部署站点

#!/bin/bash  
# chkconfig: 2345 74 44
  
# description: Tomcat is a Java Servlet Container
  
. /etc/profile
  
TOMCAT_HOME=/application/tomcat/
  
start () {
  
TOMCAT_PID=`ps -ef |grep "$TOMCAT_HOME" |grep -v "grep" |awk '{print $2}'`
  
if [ -z $TOMCAT_PID ];then
  
    /bin/bash $TOMCAT_HOME/bin/startup.sh
  
else
  
    echo "$0 isrunning"
  
fi
  
}
  
stop () {
  
TOMCAT_PID=`ps -ef |grep "$TOMCAT_HOME" |grep -v "grep" |awk '{print $2}'`
  
if [ -z $TOMCAT_PID ];then
  
      echo "$0 is not running"
  
else
  
      echo "shutting down $0"
  
      kill -9 "$TOMCAT_PID" && echo "PID $TOMCAT_PID killed."
  
fi
  
}
  
status () {
  
TOMCAT_PID=`ps -ef |grep "$TOMCAT_HOME" |grep -v "grep" |awk '{print $2}'`
  
if [ -z $TOMCAT_PID ];then
  
      echo "$0 is not running"
  
else
  
      echo "$0 is running PID is $TOMCAT_PID"
  
fi
  
}
  
case $1 in
  
start)
  
start
  
#tail -f $TOMCAT_HOME/logs/catalina.out
  
;;
  
stop)
  
stop
  
;;
  
status)
  
status
  
;;
  
restart)
  
stop
  
start
  
#tail -f $TOMCAT_HOME/logs/catalina.out
  
;;
  
*)
  
echo "Usage:$0{start|stop|status|restart}."
  
;;
  
esac


页: [1]
查看完整版本: tomcat+nginx部署站点