• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >linux shell > 自动杀掉占用较多CPU资源的Shell脚本

自动杀掉占用较多CPU资源的Shell脚本

作者: 字体:[增加 减小] 来源:互联网

通过本文主要向大家介绍了杀掉汝爱,杀掉那个爱尔兰人,不要吃太胖会被杀掉的,gta5杀掉陪审员,杀掉火柴人等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

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

</div>

您可能想查找下面的文章:

  • 自动杀掉占用较多CPU资源的Shell脚本
  • 杀掉oracle在线用户脚本分享

相关文章

  • C语言实现的ls命令源码分享
  • Shell中实现字符串反转方法分享
  • linux下passwd命令设置修改用户密码的方法
  • CentOS 6.3下给PHP添加mssql扩展模块教程
  • 统计网卡流量的两段shell脚本(使用ifconfig)
  • Bash Shell字符串操作小结
  • linux安装php扩展脚本分享
  • 一个监控LINUX目录和文件变化的Shell脚本分享
  • Shell编程 Bash引号的那点事
  • 虚拟机中使用linux系启用文件共享之后的文件存在的位置方法

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • Shell脚本字符串单引号和双引号的区别浅析
    • Shell脚本避免重复执行的方法
    • bash脚本编程学习之算术运算与文件查找
    • 简单的远程FTP定时备份Shell脚本分享
    • linux shell实现守护进程脚本
    • Shell脚本实现批量添加用户
    • Shell脚本实现自动修改IP、主机名等功能分享
    • 浅谈ctrl+c,ctrl+d,ctrl+z在linux中的意义
    • 图片批量压缩大小脚本分享
    • 一个shell小案例(创建日期目录)

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有