php-resque-ex icon indicating copy to clipboard operation
php-resque-ex copied to clipboard

workerPids broken on CentOS 6.6

Open elronalds opened this issue 10 years ago • 5 comments

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.

elronalds avatar Jul 30 '15 13:07 elronalds

So it fix Solaris, but breaks CentOS ? What a pain ...T.T

wa0x6e avatar Jul 30 '15 14:07 wa0x6e

@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.

elronalds avatar Jul 31 '15 01:07 elronalds

I'll put an if/else to target CentOS < 7 then

wa0x6e avatar Jul 31 '15 11:07 wa0x6e

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)?

manierim avatar Aug 06 '15 00:08 manierim

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.

wa0x6e avatar Aug 06 '15 11:08 wa0x6e