while true;do echo "`date` ----> `pstree | grep httpd` : `pstree | grep startup.sh`" ; sleep 3; done;
좀더 복잡하게
while true;do echo "`date` ----> `pstree | grep httpd | awk -F - '{print $4}'` , `pstree | grep startup.sh | awk -F --- '{print $3}'` , Cpu : `top -d 0.5 -b -n2 | grep "Cpu(s)"|tail -n 1 | awk '{print $2 + $4}'`" ; sleep 1; done;
아래는 실행결과!!
while true;do echo "`date` ----> `pstree | grep httpd | awk -F - '{print $4}'` , `pstree | grep java | awk -F --- '{print $2}'` , Cpu : `top -d 0.5 -b -n2 | grep "Cpu(s)"|tail -n 1 | awk '{print $2 + $4}'`" ; sleep 1; done;
또는 이거 (tomcat 프로세스 찾기 변경)