Skip to content

Linux/Mac定期自动清理僵尸进程

Tags:
# crontab -e 当中
0 */12 * * * kill -9 $(ps -A -ostat,ppid | grep -e '[zZ]'| awk '{ print $2 }')

# 或者在~/.zshrc中加入一条
alias clean_zoombie_process='kill -9 $(ps -A -ostat,ppid | grep -e "[zZ]"| awk "{ print $2 }")'

# crontab -e 当中
source ~/.zshrc && clean_zoombie_process

Leave a Reply

Your email address will not be published.