php-resque-ex
php-resque-ex copied to clipboard
workerPids broken on CentOS 6.6
The commit https://github.com/kamisama/php-resque-ex/commit/bc6b543b31770a05ee5e1ab262d133e7f45565fc breaks functionality on CentOS 6.6.
ps -A -o pid,comm | grep [r]esque doesn't return any resque processes on CentOS 6.6, however the previous code ps -A -o pid,command | grep [r]esque does work fine.
So it fix Solaris, but breaks CentOS ? What a pain ...T.T
@kamisama I have some other servers that are running CentOS 7 and the new command ps -A -o pid,comm | grep [r]esque works fine. CentOS 6 is still widely used though, probably more than Solaris I would suspect.
I'll put an if/else to target CentOS < 7 then
Ah... on my dev virtual machines both CentOS 6.6 and CentOS 7.1.1503 needs command.
From ps man:
comm is just the "command name (only the executable name)"
command alias args: "command with all its arguments as a string"
so comm just returns php for the actual worker process (so grep doesn't find [r]esque), while command shows the entire arguments, therefore grep find the worker process as well as all the parent processes, making the list "dirty".
So I fixed it using both comm and command and then checking that the executable name is php: manierim/php-resque-ex@0d22a3729c87168c85a8a01477fef03fde9326ea
Maybe checking Solaris manual we might find a common way?
Or we have to use php_uname() to build the command conditionally (i.e. is there a ps equivalent under WIN systems)?
I'm not familiar with CentOS nor Solaris, but I think we should revert the commit, and make the patch only target Solaris system with a condition.