bin bash PID cat var run catalina pid cd usr tomcat bin shutdown sh if

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#!/bin/bash
PID=`cat /var/run/catalina.pid`
cd /usr/tomcat/bin; ./shutdown.sh
if [ $? != 0 ]
then
kill -9 $PID
echo "`date` killed with -9" >> /var/log/tomcat.log
else
echo "`date` Tomcat stopped" >> /var/log/tomcat.log
fi
cd /usr/tomcat/bin; ./startup.sh
if [ $? == 0 ]
then
echo "`date` Tomcat started" >> /var/log/tomcat.log
fi