#!/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