renatomefi/php-fpm-healthcheck

Missing implementation of exit status codes

jelovac opened this issue · 3 comments

Hi,

When command cgi-fcgi fails to connect to a php-fpm instance the script exists.

Shouldn't there be an implementation for the following exit codes as described in the script header:

2,9,111 - Couldn't connect to PHP fpm, is it running?

For example:

    if test "$FPM_STATUS" = "Could not connect to $1"; then
        >&2 printf "Failed to connect to php-fpm instace via $1. Is it running? \\n";
        exit 2;
    fi;

Hey @jelovac, it's a good idea, I was afraid at the beginning that would be too hard to map it all, because there are variances of how `cgi-fcgi behaves depending on the system, would you like to try to implement this one? We have tests for debian and alpine, hopefully that's enough and if people need other OS they can also implement it.

Hello @jelovac, how are you?

I tried to execute this behavior on alpine, debian and centos and I didn't found this issue.

Yes, if we execute:

$ cgi-fcgi -bind -connect localhost:9000
Could not connect to localhost:9000
$ echo $?
111

I receive this output, but php-fpm-healthcheck exits because we use set -e and cgi-fcgi exits with error.

https://github.com/renatomefi/php-fpm-healthcheck/blob/master/php-fpm-healthcheck#L42
https://github.com/renatomefi/php-fpm-healthcheck/blob/master/php-fpm-healthcheck#L58

Is there an implementation where cgi-fcgi exits without errors or set -e is ignored?

I am closing this issue.

If you need more help, please, can you reopen it?

ty