debian-mirror-gitlab/bin/web

59 lines
798 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"
unicorn_cmd="bundle exec unicorn_rails -c $unicorn_config -E $RAILS_ENV"
2014-09-02 18:07:02 +05:30
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
{
2016-06-02 11:05:42 +05:30
exec $unicorn_cmd -D
}
start_foreground()
{
2016-06-02 11:05:42 +05:30
exec $unicorn_cmd
2014-09-02 18:07:02 +05:30
}
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
;;
start_foreground)
start_foreground
;;
2014-09-02 18:07:02 +05:30
stop)
stop
;;
reload)
reload
;;
*)
echo "Usage: RAILS_ENV=your_env $0 {start|stop|reload}"
;;
esac