gitlab-org--gitlab-foss/bin/web

64 lines
910 B
Plaintext
Raw Normal View History

2014-07-04 07:45:20 +00:00
#!/bin/sh
cd $(dirname $0)/..
app_root=$(pwd)
# Switch to experimental PUMA configuration
if [ -n "${EXPERIMENTAL_PUMA}" ]; then
exec bin/web_puma "$@"
fi
unicorn_pidfile="$app_root/tmp/pids/unicorn.pid"
unicorn_config="$app_root/config/unicorn.rb"
2016-01-14 14:08:15 +00:00
unicorn_cmd="bundle exec unicorn_rails -c $unicorn_config -E $RAILS_ENV"
2014-07-04 07:45:20 +00:00
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
}
2014-07-04 07:45:20 +00:00
start()
{
exec $unicorn_cmd -D
2016-01-14 14:08:15 +00:00
}
start_foreground()
{
exec $unicorn_cmd
}
2014-07-04 07:45:20 +00:00
stop()
{
get_unicorn_pid
kill -QUIT $unicorn_pid
}
2014-07-04 07:45:20 +00:00
reload()
{
get_unicorn_pid
kill -USR2 $unicorn_pid
}
case "$1" in
start)
start
;;
2016-01-14 14:08:15 +00:00
start_foreground)
start_foreground
;;
stop)
stop
;;
reload)
reload
;;
*)
echo "Usage: RAILS_ENV=your_env $0 {start|stop|reload}"
;;
esac