Last active
August 29, 2015 14:05
-
-
Save a2f0/3dbf7a087a42373a6407 to your computer and use it in GitHub Desktop.
detect hung passenger processes by inspecting an isolated application pool, iterating, and authing against the api
This file contains 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/sh | |
#Isolate an application pool and iterate through and authenticate | |
#Written by Dan Sullivan | |
#Will detect hung processes | |
IFS=$'\n' | |
for i in $(rvmsudo passenger-status --verbose | | |
pcregrep -M '/opt(.|\n)*^/opt' | | |
grep -v Requests | grep -v ^/ | | |
grep -v "App root" | grep -v CPU | | |
sed ':a;N;$!ba;s/s\n/,/g' | | |
sed '/^$/d' | sed ':a;N;$!ba;s/\n /,/g' | | |
awk -F'[[:space:]:/]+' '{print $4,$16,$18}' | tr -d ',' | |
); | |
do | |
echo $i | awk '{ print $1,$2,$3 }'; | |
pid=`echo $i | awk '{ print $1 }'`; | |
port=`echo $i | awk '{ print $2 }'`; | |
password=`echo $i | awk '{ print $3 }'`; | |
echo "pid: $pid, port: $port, password: $password" | |
curl -H "X-Passenger-Connect-Password: $password" "http://127.0.0.1:$port" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment