Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
Important
Description
State of the world
This commit introduced a new approach to check if the ActiveMQ process is running.
The new approach lists all processes with `ps` command and then greps it:
local RET="`ps -o "pid,args" | grep "^$activemq_pid\s.*java"`"
Issue
If ActiveMQ process was started with N digit PID and `ps` command returns processes with M digit PID (such that M > N) then `bin/activemq` script won't be able to identify if ActiveMQ is running.
Example
$ ps -o "pid,args" PID COMMAND XX ActiveMQ java PROCESS XXX ANOTHER PROCESS 1 XXXX ANOTHER PROCESS 2 XXXXX ANOTHER PROCESS N
In this example `ActiveMQ java PROCESS` is running with a two-digit PID `XX`.
`ANOTHER PROCESS N` is running with a five-digit PID `XXXXX`.
`ps` command will add additional spaces before the `ActiveMQ java PROCESS` to align it to the five-digit PID of `ANOTHER PROCESS N`.
In this case the grep experssion `^$activemq_pid\s.*java` wont be able to identify the `ActiveMQ java PROCESS` with PID `XX`.