濮阳杆衣贸易有限公司

主頁 > 知識庫 > 自動殺掉占用較多CPU資源的Shell腳本

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

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

復制代碼 代碼如下:

#!/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

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

標簽:淘寶邀評 許昌 赤峰 邵陽 婁底 馬鞍山 巴彥淖爾 金昌

巨人網絡通訊聲明:本文標題《自動殺掉占用較多CPU資源的Shell腳本》,本文關鍵詞  自動,殺掉,占用,較多,CPU,;如發(fā)現(xiàn)本文內容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內容系統(tǒng)采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《自動殺掉占用較多CPU資源的Shell腳本》相關的同類信息!
  • 本頁收集關于自動殺掉占用較多CPU資源的Shell腳本的相關信息資訊供網民參考!
  • 推薦文章
    台中市| 德安县| 辉县市| 曲阜市| 镇安县| 白水县| 灵寿县| 区。| 新蔡县| 房山区| 乡城县| 鹿邑县| 兰州市| 怀远县| 寿阳县| 定安县| 多伦县| 临湘市| 兰州市| 延边| 中阳县| 赣州市| 当阳市| 禄劝| 贵德县| 南开区| 嘉定区| 龙南县| 嘉善县| 新密市| 马鞍山市| 集贤县| 格尔木市| 阜康市| 桂林市| 临湘市| 寻甸| 小金县| 盐山县| 垦利县| 湄潭县|