`

Monitor a process, if have run for more than 2 mins,kill it.

阅读更多
#!/bin/bash -l
process_name='phantomjs'
long_term=1
pids=` ps -ef | grep -i "$process_name"  | grep -v 'grep' | awk '{print $2;}'`

if [ "$pids" == "" ]; then
   echo "no phantomjs running" >/dev/null
   exit 0
fi


for pid in $pids; do
  echo $pid
  etimes_min=` ps -p $pid -o etime=|awk -F":" '{print($(NF-1))}'`
  etimes_min=`echo $etimes_min | sed 's/^0//'`
  echo $etimes_min,$long_term
  if [ "$etimes_min" -gt "$long_term" ]; then
        kill -9 $pid >/dev/null
        timestamp=`date '+%Y%m%d %H:%M'`
        echo "$timestamp: killed $pid for $process_name, for it took more than 2 minus" >> "kill-long-term-phantomjs-processes.log"
  fi
done

 

分享到:
评论

相关推荐

    ProcessMonitor.zip

    C:\Downloads\ProcessMonitor.C:\Downloads\ProcessMonitor.zipzip

    Process Monitor v3.50

    reliable process information, full thread stacks with integrated symbol support for each operation, simultaneous logging to a file, and much more. Its uniquely powerful features will make Process ...

    process monitor 进程监测工具

    reliable process information, full thread stacks with integrated symbol support for each operation, simultaneous logging to a file, and much more. Its uniquely powerful features will make Process ...

    Process Monitor中文手册.CHM

    比如,如果用户A把挂载的一个共享作为Z:盘符,则在Process Monitor中,所有对这个共享的操作都会被显示为相对于驱动器Z:。想在列表中清除文件系统的操作,在Process Monitor工具栏上反选“文件系统”按钮,再次按下...

    Process Monitor v3.53.zip

    Process Monitor是Windows的高级监视工具,可显示实时文件系统,注册表和进程/线程活动。它结合了两个旧的Sysinternals实用程序Filemon和 Regmon的功能,并添加了广泛的增强功能列表,包括丰富的和非破坏性的过滤,...

    Process Monitor v3.2 windows 注册表监控, 文件读写监控

    reliable process information, full thread stacks with integrated symbol support for each operation, simultaneous logging to a file, and much more. Its uniquely powerful features will make Process ...

    进程监视器Process Monitor V3.20中文汉化版.zip

    Process Monitor 就绪实例/Terminate 终止所有 Process Monitor 实例并退出/Quiet 启动时不确认过滤器设置/Run32 运行 32 位版本加载 32 位日志文件 (仅适用于 x64 )/HookRegistry 为 SoftGrid ...

    Process Monitor.vi LABVIEW

    NI Process Monitor.vi LABVIEW

    微软内部资料-SQL性能优化2

    A 32-bit process is normally limited to addressing 2 gigabytes (GB) of memory, or 3 GB if the system was booted using the /3G boot switch even if there is more physical memory available. By leveraging...

    Process Monitor.vi

    用于Labview的进程监控子VI,在高版本的中文版Labview中,不易查找

    SQL Monitor for Oracle,MySQL和DB2 v2.4.3.6 中文绿色版

    SQL Monitor for Oracle,MySQL and DB2 是款免费的数据库跟踪工具,专门用来分析CPU使用率高的问题。 软件功能: 1. 监控SQL Server的进程和Job,查看当前执行的SQL/命令,并终止之。 2. 对象浏览器,跟 SQL Server...

    PRTG Network Monitor 13 破解工具

    2.) When asked for a license, install freeware version. 3.) After installation process is done kill "PRTG Server.exe" process from background with Windows Task Manager (ctrl+Shift+Esc). 4.) Copy ...

    ProcessMonitor进程监视.zip

    Process Monitor一款系统进程监视软件,总体来说,Process Monitor相当于Filemon+Regmon,其中的Filemon专门用来监视系统 中的任何文件操作过程,而Regmon用来监视注册表的读写操作过程。 有了Process Monitor,使用...

    EurekaLog_7.5.0.0_Enterprise

    2)....Added: Performance counters for run-time (internal logging with --el_debug) 3)....Fixed: spawned by ecc32/emake processes now start with the same priority 4)....Fixed: ThreadID = 0 in ...

    Process Monitor 1.35 汉化版

    Process Monitor 英文原版下载地址:http://download.sysinternals.com/Files/ProcessMonitor.zip Process Monitor 1.35 汉化版下载地址:http://download.cnbeta.com/wbpluto/ProcessMonitorHH.rar

    进程分析工具ProcessMonitor.zip

    进程分析工具ProcessMonitor.zip

    Labview 中Process Monitor

    Labview中的第一个小实验,使用Process Monitor控件实现温度、压力以及容积的变化

    Process Monitor.rar

    Process Monitor.rar Process Monitor.vi

    ProcessMonitor

    Process Monitor一款系统进程监视软件,总体来说,Process Monitor相当于Filemon+Regmon,其中的Filemon专门用来监视系统 中的任何文件操作过程,而Regmon用来监视注册表的读写操作过程。 有了Process Monitor,使用...

Global site tag (gtag.js) - Google Analytics