Skip to content

Get the PID of a running Java process using only BASH tools

I need to get the PID of a running Java process, in this case Glassfish 3 to see if it is running before I run some asadmin commands.

ps -ax | grep "java -cp /opt/bmam/glassfish" | grep -v "grep" | cut -d " " -f 1
26306