Skip to content

Instantly share code, notes, and snippets.

@pgib
Created July 27, 2010 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgib/492540 to your computer and use it in GitHub Desktop.
Save pgib/492540 to your computer and use it in GitHub Desktop.
alias restart_nvidia="restart_thin ~/nvidia_gtc"
alias restart_renesas="restart_thin ~/renesas_devcon"
restart_thin()
{
origpath=`pwd`
path=$1
if [ -z "$path" ]; then
echo "Usage: restart_thin <app root path>"
return 1
elif [ ! -d $path ]; then
echo "Usage: restart_thin <app root path>"
return 1
elif [ ! -d $path/config/thin ]; then
echo "$1 is not a valid app path. Missing $1/config/thin."
return 1
fi
cd $path
md5=`echo "$1" | md5`
if [ -e /tmp/$md5 ]; then
whom=`cat /tmp/$md5`
echo "Thin is already being restarted by ${whom}."
return 2
fi
echo $SUDO_USER > /tmp/$md5
echo "Restarting Thin in $path"
thin -C config/thin/production.yml restart && echo "Thin restarted."
rm /tmp/$md5
cd $origpath
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment