Skip to content

Instantly share code, notes, and snippets.

@bradhe
Created December 5, 2013 23:09
Show Gist options
  • Select an option

  • Save bradhe/7815715 to your computer and use it in GitHub Desktop.

Select an option

Save bradhe/7815715 to your computer and use it in GitHub Desktop.
Shell script for testing how long it takes for Foreman + Unicorn to come online during start up.
#!/bin/bash
# Start a new foreman. We'll need the PID for later.
foreman start redis=1,web=1 &
FOREMAN_PID=$!
while :
do
curl http://localhost:5000/login &> /dev/null
if [ $? -eq 0 ]; then
break
fi
done
sudo kill $FOREMAN_PID
sudo kill -s TERM $FOREMAN_PID
sudo kill -s KILL $FOREMAN_PID
# because fuck foreman, that's why.
ps waxu | grep [u]nicorn | awk '{print $2}' | xargs sudo kill
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment