最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

自動殺掉占用較多CPU資源的Shell腳本

 更新時間:2014年06月09日 09:25:18   作者:  
這篇文章主要介紹了自動殺掉占用較多CPU資源的Shell腳本,需要的朋友可以參考下

復(fù)制代碼 代碼如下:

#!/bin/bash

# March-13-2006
# CPUuse trigger script by Noel
#
# bash code to watch a running program's CPU usage.
# if it's above a set value, it will auto send an email.
# You will need to set a Cron job to run this script every xx minutes
#
# Set some needed things:
#
processToWatch="convert" # in my case I need to watch convert
emailAddress="root@host" # this is my main emailaddress
triggerValue=90 # if the CPU use is above 90% send an email. DO NOT USE a DOT or COMMA!
tempFileName=tmp-cpu # some name of the temp file for the ps, grep data

ps auxww | grep "$processToWatch" | grep -v grep > /tmp/$tempFileName
export LINE
(
read LINE
while [ -n "$LINE" ]
do
set $LINE
read LINE
if [ $(echo "$3" | sed -e 's/\.[0-9]*//g') -gt $triggerValue ]; then
mail -s "CPU message alert for: $processToWatch" $emailAddress <<-END
This is to inform you that the following process: $processToWatch with PID (Process ID) $2 is now using more than your preset $triggerValue value.

Process: $processToWatch is using: $3 of CPU power!
The command used is: $11
END
fi
done
)< /tmp/$tempFileName

相關(guān)文章

最新評論

巨野县| 青龙| 道真| 平邑县| 拉萨市| 五常市| 双鸭山市| 同心县| 旌德县| 宿松县| 肇州县| 厦门市| 东城区| 禄丰县| 东宁县| 崇左市| 修文县| 横峰县| 沽源县| 岫岩| 太原市| 手机| 上饶市| 汝州市| 巫溪县| 九台市| 永春县| 彭州市| 阜阳市| 扎兰屯市| 青州市| 天柱县| 盘山县| 泗阳县| 万荣县| 宜川县| 尼勒克县| 武强县| 盐池县| 怀柔区| 桃江县|