Created
July 2, 2018 15:04
-
-
Save kapb14/2c254f65dc5b39b167330270665d5df4 to your computer and use it in GitHub Desktop.
php fpm status commandline script with pool name as argument
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [[ -z $1 ]]; then | |
| pool_name="www" | |
| elif [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "help" ]]; then | |
| echo "Usage: $(basename $0) [FPM_POOL_NAME]" | |
| exit 1 | |
| elif [[ "$1" == "--list" ]] || [[ "$1" == "-l" ]] || [[ "$1" == "list" ]]; then | |
| for p in $(grep -h "^\[" /etc/php/7.1/fpm/pool.d/*.conf | tr -d '[|]'); do | |
| echo " ${p}" | |
| done | |
| exit 1 | |
| else | |
| pool_name="$1" | |
| fi | |
| pool_config=$(grep -l "^\[${pool_name}" /etc/php/7.1/fpm/pool.d/*.conf) | |
| pool_listener=$(grep -h '^listen =' ${pool_config} | awk $'{print $3}') | |
| cat <<EOF | |
| pool name: ${pool_name} | |
| pool config: ${pool_config} | |
| pool listener: ${pool_listener} | |
| EOF | |
| SCRIPT_NAME=/status SCRIPT_FILENAME=/status REQUEST_METHOD=GET QUERY_STRING="" /usr/bin/cgi-fcgi -bind -connect ${pool_listener} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment