Commit f57944cc6170e1c06e7fe18e52a08c90ccb10ddb
Committed by
Rovanion Luckey
1 parent
7c38f4e2
Exists in
master
and in
4 other branches
Corrections suggested by jacobvosmaer
Showing
1 changed file
with
15 additions
and
8 deletions
Show diff stats
lib/support/init.d/gitlab
@@ -20,8 +20,8 @@ RAILS_ENV="production" | @@ -20,8 +20,8 @@ RAILS_ENV="production" | ||
20 | 20 | ||
21 | # Script variable names should be lower-case not to conflict with internal | 21 | # Script variable names should be lower-case not to conflict with internal |
22 | # /bin/sh variables such as PATH, EDITOR or SHELL. | 22 | # /bin/sh variables such as PATH, EDITOR or SHELL. |
23 | -app_root="/home/git/gitlab" | ||
24 | -app_user="git" | 23 | +app_root="/home/gitlab/gitlab" |
24 | +app_user="gitlab" | ||
25 | unicorn_conf="$app_root/config/unicorn.rb" | 25 | unicorn_conf="$app_root/config/unicorn.rb" |
26 | pid_path="$app_root/tmp/pids" | 26 | pid_path="$app_root/tmp/pids" |
27 | socket_path="$app_root/tmp/sockets" | 27 | socket_path="$app_root/tmp/sockets" |
@@ -99,7 +99,7 @@ check_stale_pids(){ | @@ -99,7 +99,7 @@ check_stale_pids(){ | ||
99 | } | 99 | } |
100 | 100 | ||
101 | # If no parts of the service is running, bail out. | 101 | # If no parts of the service is running, bail out. |
102 | -check_not_running(){ | 102 | +exit_if_not_running(){ |
103 | check_stale_pids | 103 | check_stale_pids |
104 | if [ "$web_status" != "0" -a "$sidekiq_status" != "0" ]; then | 104 | if [ "$web_status" != "0" -a "$sidekiq_status" != "0" ]; then |
105 | echo "GitLab is not running." | 105 | echo "GitLab is not running." |
@@ -138,7 +138,7 @@ start() { | @@ -138,7 +138,7 @@ start() { | ||
138 | 138 | ||
139 | # Asks the Unicorn and the Sidekiq if they would be so kind as to stop, if not kills them. | 139 | # Asks the Unicorn and the Sidekiq if they would be so kind as to stop, if not kills them. |
140 | stop() { | 140 | stop() { |
141 | - check_not_running | 141 | + exit_if_not_running |
142 | # If the Unicorn web server is running, tell it to stop; | 142 | # If the Unicorn web server is running, tell it to stop; |
143 | if [ "$web_status" = "0" ]; then | 143 | if [ "$web_status" = "0" ]; then |
144 | kill -QUIT "$wpid" & | 144 | kill -QUIT "$wpid" & |
@@ -178,7 +178,7 @@ stop() { | @@ -178,7 +178,7 @@ stop() { | ||
178 | 178 | ||
179 | # Returns the status of GitLab and it's components | 179 | # Returns the status of GitLab and it's components |
180 | status() { | 180 | status() { |
181 | - check_not_running | 181 | + exit_if_not_running |
182 | if [ "$web_status" = "0" ]; then | 182 | if [ "$web_status" = "0" ]; then |
183 | echo "The GitLab Unicorn webserver with pid $wpid is running." | 183 | echo "The GitLab Unicorn webserver with pid $wpid is running." |
184 | else | 184 | else |
@@ -195,14 +195,21 @@ status() { | @@ -195,14 +195,21 @@ status() { | ||
195 | } | 195 | } |
196 | 196 | ||
197 | reload(){ | 197 | reload(){ |
198 | - check_not_running | 198 | + exit_if_not_running |
199 | if [ "$wpid" = "0" ];then | 199 | if [ "$wpid" = "0" ];then |
200 | echo "The GitLab Unicorn Web server is not running thus it's configuration can't be reloaded." | 200 | echo "The GitLab Unicorn Web server is not running thus it's configuration can't be reloaded." |
201 | exit 1 | 201 | exit 1 |
202 | fi | 202 | fi |
203 | - printf "Reloading GitLab configuration... " | ||
204 | - kill -HUP "$wpid" | 203 | + printf "Reloading GitLab Unicorn configuration... " |
204 | + kill -USR2 "$wpid" | ||
205 | echo "Done." | 205 | echo "Done." |
206 | + echo "Restarting GitLab Sidekiq since it isn't capable of reloading it's config..." | ||
207 | + RAILS_ENV=$RAILS_ENV bundle exec rake sidekiq:stop | ||
208 | + echo "Starting Sidekiq..." | ||
209 | + RAILS_ENV=$RAILS_ENV bundle exec rake sidekiq:start | ||
210 | + # Waiting 2 seconds for sidekiq to write it. | ||
211 | + sleep 2 | ||
212 | + status | ||
206 | } | 213 | } |
207 | 214 | ||
208 | 215 |