PID is assigned by the kernel, you cannot specify what it will be. As far as determining what the pid is: Code: java -jar somejar.jar & JAVAPID=$(pgrep -s 0 java)
No, the -s 0 flag tells pgrep to only check the session of the parent shell when matching the process name. If you `pgrep java` you will list EVERY process with "java" somewhere in it, system/user-wide, which may or may not be the one you want. The shell variable $JAVAPID holds the PID of the process you launched in the first line (or should, if you have multiple child processes that contain 'java' it will contain them all.) Edit: man pgrep for more information on how to refine the search, but my example should work in the simple case of just one java child process.
Thanks for your idea, I do it with another thing but the same idea ^^ thanks Code: kill -9 $(ps aux | grep craftbukkit | head -1 | cut -d' ' -f6)