本文共 1039 字,大约阅读时间需要 3 分钟。
#!/bin/bash# chkconfig: 2345 80 12# processname: market_tomcatsource /etc/init.d/functions[ -r "$SYSCONFIG" ] && source "$SYSCONFIG"RETVAL=0TOMCAT_NAME=market_tomcatstart() { pid=`ps -ef |grep $TOMCAT_NAME|grep -v grep|wc -l` if [ $pid -ne 0 ];then echo "market already running...." exit 1 fi echo -n $"Starting $TOMCAT_NAME: " daemon /data/$TOMCAT_NAME/bin/catalina.sh start RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$TOMCAT_NAME return $RETVAL}stop() { echo -n $"Stop $TOMCAT_NAME:" daemon /data/$TOMCAT_NAME/bin/shutdown.sh if [ `ps -ef |grep $TOMCAT_NAME|grep -v grep |wc -l` -ne 0 ];then ps -ef |grep $TOMCAT_NAME|grep -v grep |awk '{print $2}'|xargs kill -9 fi RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -rf /var/lock/subsys/$TOMCAT_NAME return $RETVAL}restart() { stop sleep 5 start}case "$1" in start) start ;; stop) stop ;; restart) restart ;;esacexit $RETVAL
转载于:https://blog.51cto.com/heygirl32895/1622231