Linux下查看tomcat内存状况并执行重启命令
#!/bin/bashPATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/binexport PATHexport JAVA_HOME=/usr/java/jdk1.6.0_13export JRE_HOME=$JAVA_HOME/jreexport CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/libexport PATH=$PATH:$JAVA_HOME/binexport LANG=en_US.UTF-8ram_max=25pid_ram=`ps -ef | grep java| grep -v "grep"|awk '{print $2}'|xargs|awk '{print $1}'`ram=`ps -e -o 'user,pid,%cpu,%mem,vsz,rss,tty,stat,start,time,command' |grep java|grep -v grep |awk '{print $4}'|xargs|awk '{print $1}'`#echo $pid_ram#echo $ram#echo $ram_maxif(echo $ram $ram_max | awk '!($1>$2){exit 1}')then#echo 1kill -9 $pid_ramsleep 2cd /usr/java/tomcat5.5/bin\./startup.shfi?