linux下的tomcat启动脚本

#!/bin/sh
export JAVA_HOME=/opt/project/qhmis/jdk1.7.0_80
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH


echo 'qh startup'
echo 'unzip *.zip begin'
cd /opt/project/qhmis
if [ -f *.zip ]
then
	unzip -o *.zip
	echo 'unzip -o *.zip'
fi
echo 'unzip *.zip end'

echo 'delete *.zip begin'
rm -rf *.zip
sleep 2
while [ -d tim ]
do
	sleep 2
done
echo 'delete end'

echo 'delete *.zip'
rm -rf *.zip
sleep 2
while [ -f *.zip ]
do
	sleep 2
done
echo 'delete *.zip end'

sleep 5

count=`ps -ef | grep /opt/project/qhmis/apache-tomcat-7.0.96 |grep -v "grep"| wc -l`  
echo "startup pidcount== $count" 
if [ $count -gt 0 ];  then
	pid=`ps -ef |grep "/opt/project/qhmis/apache-tomcat-7.0.96"| grep -v "grep"|awk '{print $2}'` 
	echo "pid== $pid"

	for id in $pid
	do
		kill -9 $id
		echo "killed $id"
	done
fi

echo 'delete tomcat cache begin'
cd /opt/project/qhmis/apache-tomcat-7.0.96
rm -rf work
sleep 2
while [ -f *work ]
do
	sleep 2
done
echo 'delete tomcat cache end'

cd /opt/project/qhmis/apache-tomcat-7.0.96/bin
./startup.sh

echo 'startup end'

echo 'view log'
tail -f /opt/project/qhmis/apache-tomcat-7.0.96/logs/catalina.out

 

你可能感兴趣的:(java,linuxs,其他技术)