renatomefi/php-fpm-healthcheck

centos not support usage of ' | tail +5'

Veitor opened this issue · 2 comments

I use this script on centos, but failed.

error output like this:

[root@root /] echo "any text" | tail +5
[root@root /] tail: cannot open `+5' for reading: No such file or directory

or

[root@root /] FCGI_CONNECT=/dev/shm/php-fpm.socket FCGI_STATUS_PATH=/fpm/status ./php-fpm-healthcheck.sh --verbose
[root@root /] Trying to connect to php-fpm via: /dev/shm/php7-fpm.socket/fpm/status
[root@root /] tail: cannot open `+5' for reading: No such file or directory

On Centos tail behaves differently:
from man:

-n, --lines=K            output the last K lines, instead of the last 10;
                             or use -n +K to output starting with the Kth

if you modify https://github.com/renatomefi/php-fpm-healthcheck/blob/master/php-fpm-healthcheck#L59
to tail -n +5
it will work.

Resolved.