最近,安裝系統(tǒng)centos 5.4 64位 安裝xen,運(yùn)行一段時(shí)間后發(fā)現(xiàn),load avg 高達(dá)200的負(fù)載,ssh登陸慢,系統(tǒng)運(yùn)行慢原因排查,主要原因是:centos 5.4 系統(tǒng)的bug /etc/cron.hourly 腳本中cat /sys/hypervisor/uuid 導(dǎo)致的僵死,吞噬了系統(tǒng)資源造成
root 5206 5204 0 16:01 ? 00:00:00 /bin/bash /usr/bin/run-parts /etc/cron.hourly
root 5209 5206 0 16:01 ? 00:00:00 /bin/bash /etc/cron.hourly/mcelog.cron
root 5210 5206 0 16:01 ? 00:00:00 awk -v progname=/etc/cron.hourly/mcelog.cron progname {????? print progname ":\n"????? progname="";????
/etc/cron.hourly/mcelog.cron
#!/bin/bash
if [ -e /proc/xen ] && [ `cat /sys/hypervisor/uuid` !=
"00000000-0000-0000-0000-000000000000" ]; then
# this is a PV Xen guest. Do not run mcelog.
exit 1;
else
/usr/sbin/mcelog --ignorenodev --filter >> /var/log/mcelog
fi
解決:
#!/bin/bash
#if [ -e /proc/xen ] && [ `cat /sys/hypervisor/uuid` !=
"00000000-0000-0000-0000-000000000000" ]; then
if [ -e /proc/xen/capabilities ] ;then
# this is a PV Xen guest. Do not run mcelog.
if ! grep control_d /proc/xen/capabilities ;then
exit 1;
fi
else
/usr/sbin/mcelog --ignorenodev --filter >> /var/log/mcelog
fi