debian-mirror-gitlab/bin/web
2014-09-02 14:37:02 +02:00

49 lines
710 B
Bash
Executable file

#!/usr/bin/env bash
cd $(dirname $0)/..
app_root=$(pwd)
unicorn_pidfile="$app_root/tmp/pids/unicorn.pid"
unicorn_config="$app_root/config/unicorn.rb"
function get_unicorn_pid
{
local pid=$(cat $unicorn_pidfile)
if [ -z $pid ] ; then
echo "Could not find a PID in $unicorn_pidfile"
exit 1
fi
unicorn_pid=$pid
}
function start
{
bundle exec unicorn_rails -D -c $unicorn_config -E $RAILS_ENV
}
function stop
{
get_unicorn_pid
kill -QUIT $unicorn_pid
}
function reload
{
get_unicorn_pid
kill -USR2 $unicorn_pid
}
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
*)
echo "Usage: RAILS_ENV=your_env $0 {start|stop|reload}"
;;
esac