debian-mirror-gitlab/bin/web

50 lines
674 B
Text
Raw Normal View History

2015-04-26 12:48:37 +05:30
#!/bin/sh
2014-09-02 18:07:02 +05:30
cd $(dirname $0)/..
app_root=$(pwd)
unicorn_pidfile="$app_root/tmp/pids/unicorn.pid"
unicorn_config="$app_root/config/unicorn.rb"
2015-04-26 12:48:37 +05:30
get_unicorn_pid()
2014-09-02 18:07:02 +05:30
{
local pid=$(cat $unicorn_pidfile)
2015-04-26 12:48:37 +05:30
if [ -z "$pid" ] ; then
2014-09-02 18:07:02 +05:30
echo "Could not find a PID in $unicorn_pidfile"
exit 1
fi
unicorn_pid=$pid
}
2015-04-26 12:48:37 +05:30
start()
2014-09-02 18:07:02 +05:30
{
bundle exec unicorn_rails -D -c $unicorn_config -E $RAILS_ENV
}
2015-04-26 12:48:37 +05:30
stop()
2014-09-02 18:07:02 +05:30
{
get_unicorn_pid
kill -QUIT $unicorn_pid
}
2015-04-26 12:48:37 +05:30
reload()
2014-09-02 18:07:02 +05:30
{
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