I'm working on a computationally heavy code that - for now - crashes a lot, but I'm still working on it :) When it crashes, I can't close the GUI window; I have to open a shell and kill -9 the process.
It is a Java process and it is easy to find:
nkint@zefiro:~$ ps aux | grep java nkint 2705 16.6 1.0 460928 43680 ? Sl 12:23 0:08 /usr/lib/jvm/java-6-sun-126.96.36.199/bin/java -Djava.library.path=something something nkint 2809 0.0 0.0 4012 776 pts/0 S+ 12:24 0:00 grep --color=auto java nkint@zefiro:~$ kill -9 2705
Now it is easy but quite a mechanical task. So normally i wait for about 7-8 processes to crash, and then
kill -9 each of them.
I want to do this in an automatic way. I think that it should be easy to pipe some commands to take the id of the (n-1) results of
ps aux | grep java and kill it but I don't have any idea where to start.
Can anyone give me any hints?