Skip to content

Instantly share code, notes, and snippets.

@incanus
Created December 6, 2011 19:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save incanus/1439681 to your computer and use it in GitHub Desktop.
Save incanus/1439681 to your computer and use it in GitHub Desktop.
Script to connect to a Heroku app's Redis instance
#!/bin/sh
echo "Connecting to Heroku Redis instance..."
if [ -n "$1" ]; then
echo "Executing \`$1\`..."
fi
url=`heroku config | grep REDISTOGO_URL | awk '{ print $3 }'`
host=`echo $url | awk -F '@' '{ print $2 }' | awk -F ':' '{ print $1 }'`
port=`echo $url | awk -F ':' '{ print $NF }' | sed -e 's/\/$//'`
api_key=`echo $url | awk -F '@' '{ print $1 }' | awk -F ':' '{ print $NF }'`
redis-cli -h $host -p $port -a $api_key $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment