-5
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

Nikki Wilson
  • 101
  • 1
  • 7
  • 2
    I think you've just answered your own question. – Michael Hampton Feb 04 '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 04 '13 at 23:23

1 Answers1

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

Chris H
  • 56
  • 3