#!/bin/sh
\033[31m红色文字\033[0m
“\033[31m红色文字\033[0m”
#tomcat logs 目录大小
echo -e ‘\033[31m&&&&&&&&&&&&&日志目录大小\033[0m’
cd /data/
du -h |grep ‘_server/logs’ | grep -v ‘task’
磁盘检查
echo -e ‘\033[31m------------磁盘检查\033[0m’
df -h | grep data
内存检查
echo -e ‘\033[31m############内存检查\033[0m’
free -m
gc安全检查
echo -e ‘\033[31m************gc检查\033[0m’
pid=ps -ef|grep java |awk '{print $2}'
for element in ${pid[@]}
#也可以写成for element in ${array[*]}
do
echo $element
sudo -u tomcat /usr/local/software/jdk1.8.0_71/bin/jstat -gcutil $element
done