最新国产好看的视频,伊人天堂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)文章

最新評論

珠海市| 宜良县| 哈密市| 阜阳市| 巧家县| 台前县| 正蓝旗| 和顺县| 威远县| 合水县| 惠水县| 韶关市| 和龙市| 泸水县| 巫山县| 郎溪县| 图木舒克市| 双鸭山市| 闻喜县| 达州市| 高邮市| 新郑市| 上饶市| 稻城县| 和龙市| 东台市| 库尔勒市| 河北省| 灌南县| 南川市| 仁怀市| 淳化县| 普兰店市| 淮南市| 凤山市| 英山县| 陈巴尔虎旗| 郸城县| 新野县| 改则县| 章丘市|