Skip to content

Instantly share code, notes, and snippets.

@jshawl
Created October 21, 2014 18:15
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 jshawl/6224acc8ba8428ce88c8 to your computer and use it in GitHub Desktop.
Save jshawl/6224acc8ba8428ce88c8 to your computer and use it in GitHub Desktop.
Restart Unicorn Git Hook
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
APP_ROOT=/var/www/superheros
UNICORN_PID=$APP_ROOT/pids/unicorn.pid
cd $APP_ROOT || exit
unset GIT_DIR
git pull origin master
# Deploy the updated code
mkdir -p $APP_ROOT
if [ -f $UNICORN_PID ]
then
kill -USR2 `cat $UNICORN_PID`
else
unicorn -c $APP_ROOT/config/unicorn.rb -D -E production
fi
exec git update-server-info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment