#!/bin/sh pid=`ps aux | grep tomcat | grep -v grep | awk '{print $2}'` echo $pid if [ -n "$pid" ] then { echo ===========shutdown================ /app/apache-tomcat-6.0.29/bin/shutdown.sh # tail -f /app1/ForceView/fvsd_nm/apache-tomcat-6.0.29/logs/catalina.out sleep 10 pid=`ps aux | grep tomcat | grep -v grep | grep -v retomcat | awk '{print $2}'` if [ -n "$pid" ] then { sleep 10 echo ========kill tomcat============== kill -9 $pid } fi echo ===========startup.sh============== sleep 10 /app/apache-tomcat-6.0.29/bin/startup.sh tail -f /app/apache-tomcat-6.0.29/logs/catalina.out } else echo ===========startup.sh============== nohup ./app/apache-tomcat-6.0.29/bin/startup.sh & tail -f /app/apache-tomcat-6.0.29/logs/catalina.out fi