Linux下查看tomcat内存状况并执行重启命令
#!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH export JAVA_HOME=/usr/java/jdk1.6.0_13 export JRE_HOME=$JAVA_HOME/jre export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib export PATH=$PATH:$JAVA_HOME/bin export LANG=en_US.UTF-8 ram_max=25 pid_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_max if(echo $ram $ram_max | awk '!($1>$2){exit 1}') then #echo 1 kill -9 $pid_ram sleep 2 cd /usr/java/tomcat5.5/bin \./startup.sh fi
相关推荐
farwang 2020-11-25
星愿心愿 2020-11-24
tianhuak 2020-11-24
zhjn0 2020-11-24
昭君出塞 2020-11-23
bluecarrot 2020-11-23
linuxwcj 2020-10-21
以梦为马不负韶华 2020-10-20
彼岸随笔 2020-10-20
yutou0 2020-10-17
applecarelte 2020-10-16
ourtimes 2020-10-16
waterhorse 2020-09-19
MRFENGG 2020-11-11
rainandtear 2020-10-30
kyssfanhui 2020-10-20
liuhangtiant 2020-10-20