Skip to content

Latest commit

 

History

History
19 lines (16 loc) · 320 Bytes

定时清除特定进程.md

File metadata and controls

19 lines (16 loc) · 320 Bytes

crontab -e

0 */1 * * * /usr/bin/curl  https://www.w3cschool.cn/tools/spider

task.sh

pids=`ps aux | grep /root/soft/docker/  | grep -v grep | awk '{print $2}'`
for x in $pids;do
	times=`ps -p $x -o etimes=`
	if [ $[$times] -gt 1000 ];then
		#kill -9 $x;
		echo $times;
		echo "$x is killed!!";
	fi
done