首頁 美術繪圖 | 美術設計 | 熱門標籤 | 首選 | 首頁宣傳 | 近期作品 論壇: 發表 | 美術工作 | 美術比賽 | 展覽活動 | 美術相關 | 一般討論 | 美術同好 CG 討論 :: Photoshop | Painter | 3D 行動 | AMP

【 立即註冊 】 : 更改個人資料 : : 登入

會員名稱: 登入密碼: 保持登入

Shell Script to Monitor process which stalled (cpu 100%)

發表新主題 回覆主題 討論區 Windows, Linux, Perl, PHP, C/C++, Driver, Web 理論、應用、硬體、軟體

| 1頁, 共1
人氣點閱:2582 發表人
Shell Script to Monitor process which stalled (cpu 100%) 2013-02-26 14:54
分類: ✔️echo ✔️echo
個人: ✔️echo ✔️echo
/ / /

Shell Script to Monitor process which stalled (cpu 100%)



Script: Use CutyCapt as an example


代碼:

#
# read last cutycapt pid
#
thisfile=/tmp/.cutycaptcheck

a=0
if [ -f "$thisfile" ]; then
        a=`head $thisfile | cut -b1-5`
fi

#
# record Capt into .cutycapcheck again
#
top -b -n 1 | grep Cuty > $thisfile

#
# read current pid
#
b=`head $thisfile | cut -b1-5`

#echo "a == $a"
#echo "b == $b"

if [ x"$a" = "x" ]; then
        logger "CutyCaptCheck: Do nothing (No A)"
        exit
fi

if [ x"$b" = "x" ]; then
        logger "CutyCaptCheck: Do nothing (No B)"
        exit
fi

if [ "$a" -eq "$b" ]; then
  logger "CutyCaptCheck: KILL pid = $a"
  kill -9 $a
else
        logger "CutyCaptCheck: Do nothing (A != B)"
fi



Then, modify the /etc/crontab if you it to run more frequently


e.g. Use "kill-CutyCapt" as an example
check if any CutyCapty stalled every 3 mins


代碼:

*/3     *       *       *       *       root    /usr/sbin/killcuty




_
Type



繪圖畫廊設計藝廊
攝影相簿留言板
最愛收藏分類標籤
暱稱: Type
註冊: 2002-11-30
發表: 11059
來自: vovo2000.com
V幣: 900569
/ / /














資訊相關理論、技術、管理、應用、產品等
發表新主題 回覆主題