]> git.apps.os.sepia.ceph.com Git - teuthology.git/commit
nuke: Use pkill -KILL to unconditionally wipe out hadoop processes 1004/head
authorNathan Cutler <ncutler@suse.com>
Tue, 27 Dec 2016 10:43:15 +0000 (11:43 +0100)
committerNathan Cutler <ncutler@suse.com>
Tue, 27 Dec 2016 10:55:32 +0000 (11:55 +0100)
commitd412c7a3dc6169b2b63fd1da7ffc0f7527506861
tree6fbef08c7a3ec701c41e2e96f3881d4b959e8738
parentd4d7e73b6dcd054df1d67e3140b35fa7337c6f68
nuke: Use pkill -KILL to unconditionally wipe out hadoop processes

In CentOS 7, the command "ps -ef | grep 'java.*hadoop' | grep -v grep | awk
'{print $2}' | xargs kill -9" produces undesirable output when no matching
processes exist.

Note: the "-f" option to pkill mimics the semantics of "ps -ef". For example,
"ps -ef | grep 'java.*hadoop'" will match a process called "sh java343hadoop",
while pkill will match that process only with the -f option:

$ ps -ef | grep "java.*hadoop" | grep -v grep
root     16165  4101  0 11:57 pts/1    00:00:00 sh java343hadoop
$ pkill -KILL "java.*hadoop"
$
$ ps -ef | grep "java.*hadoop" | grep -v grep
root     16165  4101  0 11:57 pts/1    00:00:00 sh java343hadoop
$ pkill -f -KILL "java.*hadoop"
[1]+  Killed                  sh java343hadoop

Fixes: http://tracker.ceph.com/issues/17981
Signed-off-by: Nathan Cutler <ncutler@suse.com>
teuthology/nuke/actions.py