Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
root      813251  813235  0 Feb02 ?        00:00:00 /bin/sh -c /usr/bin/test -x /usr/local/cpanel/scripts/update_db_cache && /usr/local/cpanel/scripts/update_db_cache
root      813265  813251  0 Feb02 ?        00:00:00 /usr/local/cpanel/scripts/update_db_cache
root      847051    6424  0 Feb02 ?        00:00:00 CROND

have a bunch running that are hung.

i do something like killall -9 update_db_cache

share|improve this question

closed as not a real question by mgorven, mdpc, kce, Khaled, John Gardeniers Feb 5 '13 at 11:13

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
I think you've just answered your own question. –  Michael Hampton Feb 4 '13 at 22:37
    
Use killall without -9 first, if they're still around after 30 seconds move on to -9. Check the pids as well, if they're changing between invocations of ps then you will need to kill the parent process instead. Use pstree to find it. –  Andrew B Feb 4 '13 at 23:23

1 Answer 1

Are you trying to do this while the system load is very high? If that is the case you might be better off killing those processes by process ID number (if you know the PID numbers already as in your example).

In your example: kill -9 813251 813265

You can check the system load averages as part of the output in the uptime command

killall -9 should send SIGKILL to your processes, but the process in 813251 is actually /bin/sh not update_db_cache.

You could try to kill every process where update_db_cache shows up:

sudo ps -ef |grep update_db_cache |grep -v grep |awk '{print $2}' |xargs kill -9

If you want to kill the parent PIDs as well (as Andrew B suggests) you could do the following (although I would advise against doing it blinding like this):

ps -ef |grep update_db_cache |grep -v grep |awk '{print $2" "$3}' |xargs kill -9

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.