Instantly share code, notes, and snippets.

Embed
What would you like to do?
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