- 로드 150 이상일 경우 apache restart 스크립트 -
[root@localhost ~]# cat /etc/crontab
# load check
*/1 * * * * root sh /root/load-chech.sh
[root@localhost ~]#
[root@localhost ~]# cat /root/load-chech.sh
now=`date +%Y%m%d-%H%M`
now_load=`w |grep load |awk '{print $8}' | awk -F '.' '{print $1}'`
now=`date +%Y%m%d-%H%M`
now_load=`w |grep load |awk '{print $8}' | awk -F '.' '{print $1}'`
if [ $now_load -ge 150 ] ; then
echo "[$now] $now_load" >> /var/log/load-check.log
/etc/init.d/apachectl restart >> /var/log/load-check.log
fi
[root@localhost ~]#
echo "[$now] $now_load" >> /var/log/load-check.log
/etc/init.d/apachectl restart >> /var/log/load-check.log
fi
[root@localhost ~]#
댓글 없음:
댓글 쓰기