title: 定时清理僵尸进程 tags: [] id: '2072' categories:
之前Docker搭建ServerStatus给树莓派装了个监控,发现CPU使用率偏高,一看,发现逗逼宝塔面板产生了几万个僵尸进程,只好临时用北洋的青春的脚本来定时清理一下。
#!/bin/bash
zombie_check=`ps -A -o stat,ppid,pid,cmd grep -e '^[Zz]'`
if [ -n "$zombie_check" ];
then
echo "Start to handle the zombie!!!!!"
for i in `ps aux grep -w Z grep -v grep awk '{print $2}'`
do
`ps -ef grep $i grep defunctawk '{print "kill -9 " $2 " "$3}'`
done
else
echo "There is no zombie !!!!!"
fi