Skip to content

Instantly share code, notes, and snippets.

@defanator
Created February 4, 2022 16:00
Show Gist options
  • Save defanator/657c4f59b3ac114f2876d4f650536f61 to your computer and use it in GitHub Desktop.
Save defanator/657c4f59b3ac114f2876d4f650536f61 to your computer and use it in GitHub Desktop.
Query php-fpm status from multiple instances/sockets
#!/bin/bash
# vim:sw=4:ts=4:et:
ENDPOINTS="/run/php/php7.4-fpm1.sock:/status1 /run/php/php7.4-fpm2.sock:/status2 /run/php/php7.4-fpm3.sock:/status3"
ENDPOINTS="$ENDPOINTS /run/php/php8.0-fpm1.sock:/status1 /run/php/php8.0-fpm2.sock:/status2 /run/php/php8.0-fpm3.sock:/status3"
for endpoint in $ENDPOINTS; do
socket=${endpoint%:*}
script=${endpoint##*:}
sudo -u nginx SCRIPT_NAME=${script} SCRIPT_FILENAME=${script} QUERY_STRING=full REQUEST_METHOD=GET cgi-fcgi -bind -connect ${socket}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment