#!/bin/bash
load=`top -n 1 |grep "load average:" |awk -F, '{print $4}' |awk -F : '{print $2}'`
avg=10.00
#shard=`ls /opt/supervisor/ |grep "gamex-" |awk -Fd '{print $2}'`
shard=/mnt/shard
if [ `echo "$load > $avg" |bc` -gt 0 ];then
while read shardid;do
/bin/sh gamex_run.sh $shardid
done < $shard
else
echo "it is not high" >> /mnt/auto.log
exit
fi
将脚本放置定时任务中,每分钟执行一遍进行检测load,高于10则抓取服务器性能参数