开发者

Linux - killing some processes owned by apache safely

I have a bunch of processes owned by apache that are running for days because they are stuck.

apache   11173  0.1  0.0 228248 27744 ?        Ss   Sep27   3:58 php /var/www/html/myproj/symfony cron:aggregation --env=prod  
apache   12609  0.1  0.0 228244 27744 ?        Ss   Sep18  19:30 php /var/www/html/myproj/sym开发者_高级运维fony cron:aggregation --env=prod  
apache   14646  0.1  0.0 228244 27744 ?        Ss   Sep17  21:30 php /var/www/html/myproj/symfony cron:aggregation --env=prod  
apache   15900  0.1  0.0 228244 27744 ?        Ss   Sep20  15:46 php /var/www/html/myproj/symfony cron:aggregation --env=prod  
apache   16169  0.1  0.0 228248 27752 ?        Ss   Sep22  12:16 php /var/www/html/myproj/symfony cron:aggregation --env=prod  
apache   16887  0.1  0.0 228244 27748 ?        Ss   Sep21  14:04 php /var/www/html/myproj/symfony cron:aggregation --env=prod  
apache   16950  0.1  0.0 228244 27744 ?        Ss   Sep28   2:25 php /var/www/html/myproj/symfony cron:aggregation --env=prod  
apache   19195  0.1  0.0 228244 27748 ?        Ss   Sep23  10:29 php /var/www/html/myproj/symfony cron:aggregation --env=prod  
apache   24605  0.1  0.0 228248 27752 ?        Ss   Sep24   8:48 php /var/www/html/myproj/symfony cron:aggregation --env=prod  
apache   26442  0.1  0.0 228244 27744 ?        Ss   03:45   0:50 php /var/www/html/myproj/symfony cron:aggregation --env=prod  
apache   29714  0.1  0.0 228248 27752 ?        Ss   Sep25   7:06 php /var/www/html/myproj/symfony cron:aggregation --env=prod  
apache   31031  0.1  0.0 228248 27752 ?        Ss   Sep26   5:30 php /var/www/html/myproj/symfony cron:aggregation --env=prod  

I need to kill them all. And obviously I want to do it safely.

Thus, ideally I should kill them as apache using something like this:

kill 11173 

The problem is that the apache userdoesn't have a shell.

So it seems the only way is escalate to root and kill the process as root. But it is not safely at all (I may kill other processes by mistake).

Has anybody got a better solution?

Thanks, Daniele


sudo -u apache kill 11173


This should belong on http://serverfault.com I guess... but if you want to kill all processes named apache, run killall apache as root. Alternatively, change identity to your apache user with su apache and kill your processes there using kill as you did.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜