debian-mirror-gitlab/bin/web

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

64 lines
780 B
Text
Raw Normal View History

2015-04-26 12:48:37 +05:30
#!/bin/sh
2014-09-02 18:07:02 +05:30
2019-09-30 21:07:59 +05:30
set -e
2014-09-02 18:07:02 +05:30
cd $(dirname $0)/..
2021-09-04 01:27:46 +05:30
app_root=$(pwd)
2014-09-02 18:07:02 +05:30
2021-09-04 01:27:46 +05:30
puma_pidfile="$app_root/tmp/pids/puma.pid"
puma_config="$app_root/config/puma.rb"
2014-09-02 18:07:02 +05:30
2021-09-04 01:27:46 +05:30
spawn_puma()
{
exec bundle exec puma --config "${puma_config}" --environment "$RAILS_ENV" "$@"
}
2014-09-02 18:07:02 +05:30
2021-09-04 01:27:46 +05:30
get_puma_pid()
{
pid=$(cat "${puma_pidfile}")
if [ -z "$pid" ] ; then
echo "Could not find a PID in $puma_pidfile"
2020-06-23 00:09:42 +05:30
exit 1
2021-09-04 01:27:46 +05:30
fi
echo "${pid}"
}
start()
{
spawn_puma &
}
start_foreground()
{
spawn_puma
}
stop()
{
get_puma_pid
kill -INT "$(get_puma_pid)"
}
reload()
{
kill -USR2 "$(get_puma_pid)"
}
case "$1" in
start)
start
;;
start_foreground)
start_foreground
;;
stop)
stop
;;
reload)
reload
;;
*)
echo "Usage: RAILS_ENV=your_env $0 {start|stop|reload}"
2020-06-23 00:09:42 +05:30
;;
2014-09-02 18:07:02 +05:30
esac