Linux 下殭屍進程的清理方法__Linux

來源:互聯網
上載者:User

平時很多時候發現定時檢測的指令碼kill 之後,該進程會僵死在裡面,無法清理。可以參考下面的方法清理:

有以下環境的進程:


#ps aux |grep monitorast.pl
root      3962  0.0  1.5   5652  3840 ?        Ss   10:13   0:00 /usr/bin/perl -w /root/script/monitorast.pl
root      5135  0.0  0.2   3920   740 pts/0    S+   10:52   0:00 grep monitorast.pl

 

# kill -9 3962 之後的進程狀態:

# ps aux |grep monitorast.pl
root      3962  0.0  0.0      0     0 ?        Zs   10:13   0:00 [monitorast.pl] <defunct>
root      5196  0.0  0.2   3916   668 pts/0    R+   10:52   0:00 grep monitorast.pl

 

之後再無法使用kill 來清除,那麼要清理必須從調用的進程處來kill

#ps axjf

 

    1  2616  2616  2616 ?           -1 Ss       0   0:00 crond
 2616  3960  2616  2616 ?           -1 S        0   0:00  /_ crond
 3960  3962  3962  3962 ?           -1 Zs       0   0:00      /_ [monitorast.pl] <defunct>
 3960  3970  2616  2616 ?           -1 S       51   0:00      /_ /usr/sbin/sendmail -FCronDaemon -i -odi -oem -oi -t

 

經過這裡的判斷,調用的進程沒有影響系統的其他任務在運行,所以可以直接kill父進程。

# kill -9 3960

# ps aux |grep monitorast.pl
root      5364  0.0  0.2   3916   676 pts/0    R+   10:58   0:00 grep monitorast.pl

 

現在可以看到現在沒有啦。

 

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.