bash脚本杀死PHP程序旧的然后一小时 [英] bash script to kill php process older then an hour
本文介绍了bash脚本杀死PHP程序旧的然后一小时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下内容:
kill -9 `ps aux | grep php | awk '$9 !~ /[0-9]:[0-9]/' | awk '{print $2}'`
它的作用是杀死已离开遗弃fcgid并杀死它们可用RAM的过程。我想运行此作为cron每隔一小时,但想干掉旧的然后一个小时的过程。我只是不知道如何修改脚本来做到这一点。
What it does is kill process that have been left abandoned by fcgid and kills them to free RAM. I want to run this as a cron every hour but would like to kill processes older then an hour. I'm just not sure how to modified the script to do that.
推荐答案
与解决:
/bin/ps -Ao"command,pid,ppid"|/bin/grep ' 1$'|/bin/grep /php|/bin/awk '{ print $2; }'|/usr/bin/xargs --no-run-if-empty kill -9
这篇关于bash脚本杀死PHP程序旧的然后一小时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文