濮阳杆衣贸易有限公司

主頁(yè) > 知識(shí)庫(kù) > 自動(dòng)殺掉占用較多CPU資源的Shell腳本

自動(dòng)殺掉占用較多CPU資源的Shell腳本

熱門(mén)標(biāo)簽:打電話機(jī)器人接我是他的秘書(shū) 如果做線上地圖標(biāo)注 華鋒e路航港口地圖標(biāo)注 地圖標(biāo)注員都是年輕人 客服外呼系統(tǒng)怎么樣 江蘇云電銷(xiāo)機(jī)器人公司 河南信譽(yù)好的不封卡電話外呼系統(tǒng) 揭陽(yáng)智能電話機(jī)器人推薦 百度地圖標(biāo)注錯(cuò)了有責(zé)任嗎

復(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

您可能感興趣的文章:
  • 一個(gè)用了統(tǒng)計(jì)CPU 內(nèi)存 硬盤(pán) 使用率的shell腳本
  • 統(tǒng)計(jì) cpu 內(nèi)存 使用率的shell腳本代碼
  • 消耗CPU資源的shell腳本
  • 使用shell腳本采集系統(tǒng)cpu、內(nèi)存、磁盤(pán)、網(wǎng)絡(luò)等信息
  • Linux中使用Shell腳本查看Java線程的CPU使用情況
  • Shell腳本實(shí)現(xiàn)把進(jìn)程負(fù)載均衡到多核CPU中
  • shell腳本監(jiān)控系統(tǒng)負(fù)載、CPU和內(nèi)存使用情況
  • Linux shell腳本實(shí)現(xiàn)CPU預(yù)警

標(biāo)簽:淘寶邀評(píng) 許昌 赤峰 邵陽(yáng) 婁底 馬鞍山 巴彥淖爾 金昌

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《自動(dòng)殺掉占用較多CPU資源的Shell腳本》,本文關(guān)鍵詞  自動(dòng),殺掉,占用,較多,CPU,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《自動(dòng)殺掉占用較多CPU資源的Shell腳本》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于自動(dòng)殺掉占用較多CPU資源的Shell腳本的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    宁都县| 沐川县| 绍兴县| 宝坻区| 长岛县| 苗栗县| 广元市| 中阳县| 元朗区| 宕昌县| 台东县| 车致| 土默特左旗| 定襄县| 会东县| 逊克县| 南城县| 宝丰县| 南宁市| 富阳市| 牟定县| 富锦市| 晋宁县| 贵港市| 浪卡子县| 白朗县| 简阳市| 呼和浩特市| 高碑店市| 增城市| 轮台县| 灵寿县| 湖北省| 朝阳市| 新建县| 黄陵县| 浦县| 惠安县| 闸北区| 洛阳市| 辽阳县|