0

For the code snippet I got some error which I can't explicate:

xyz@lin309-05:~/workspace/os-prj2$ ps -ef | grep node.o
xyz     21679     1  0 20:00 pts/1    00:00:00 ssh lin309-05.cise.ufl.edu cd workspace/os-prj2 ; touch /tmp/fu0 ; ./node.o host0 4001 3 2 6 3 lin309-02.cise.ufl.edu:4002 lin309-03.cise.ufl.edu:4003 storm.cise.ufl.edu:4006 host1 host2 host5 host0
xyz     21700 21699  0 20:00 ?        00:00:00 tcsh -c cd workspace/os-prj2 ; touch /tmp/fu0 ; ./node.o host0 4001 3 2 6 3 lin309-02.cise.ufl.edu:4002 lin309-03.cise.ufl.edu:4003 storm.cise.ufl.edu:4006 host1 host2 host5 host0
xyz     21738 21700  0 20:00 ?        00:00:00 ./node.o host0 4001 3 2 6 3 lin309-02.cise.ufl.edu 4002 lin309-03.cise.ufl.edu 4003 storm.cise.ufl.edu 4006 host1 host2 host5 host0
xyz     21772 20749  0 20:02 pts/1    00:00:00 grep node.o
xyz@lin309-05:~/workspace/os-prj2$ ps -ef | grep node.o | awk '{print $2}' | xargs -i kill -9 {}
kill: No such process

As you see the before invoking kill I check whether there are processes (to prove my point). And the result of the kill is that the processes are indeed killed. But why is it showing "No such process"?

Thanks.

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by nezachem
0

Look at line 5. grep found itself. It's pid among others is passed to kill, yet grep has already terminated.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.