diff options
author | Alex Groleau <agroleau@gitlab.com> | 2019-08-27 12:41:39 -0400 |
---|---|---|
committer | Alex Groleau <agroleau@gitlab.com> | 2019-08-27 12:41:39 -0400 |
commit | aa01f092829facd1044ad02f334422b7dbdc8b0e (patch) | |
tree | a754bf2497820432df7da0f2108bb7527a8dd7b8 /bin/web_unicorn | |
parent | a1d9c9994a9a4d79b824c3fd9322688303ac8b03 (diff) | |
parent | 6b10779053ff4233c7a64c5ab57754fce63f6710 (diff) | |
download | gitlab-ce-aa01f092829facd1044ad02f334422b7dbdc8b0e.tar.gz |
Merge branch 'master' of gitlab_gitlab:gitlab-org/gitlab-cerunner-metrics-extractor
Diffstat (limited to 'bin/web_unicorn')
-rwxr-xr-x | bin/web_unicorn | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/bin/web_unicorn b/bin/web_unicorn new file mode 100755 index 00000000000..ecd0bbd10b0 --- /dev/null +++ b/bin/web_unicorn @@ -0,0 +1,58 @@ +#!/bin/sh + +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" + +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 +} + +start() +{ + exec $unicorn_cmd -D +} + +start_foreground() +{ + exec $unicorn_cmd +} + +stop() +{ + get_unicorn_pid + kill -QUIT $unicorn_pid +} + +reload() +{ + get_unicorn_pid + kill -USR2 $unicorn_pid +} + +case "$1" in + start) + start + ;; + start_foreground) + start_foreground + ;; + stop) + stop + ;; + reload) + reload + ;; + *) + echo "Usage: RAILS_ENV=your_env $0 {start|stop|reload}" + ;; +esac |