Commit ec38d6290c26b6c7ad21d9436627d18402cd3f95

Authored by Axilleas Pipinellis
1 parent 8cdfa86b

Removal of gitlab.socket should be in stop function too. Fix #4313

Showing 1 changed file with 5 additions and 3 deletions   Show diff stats
lib/support/init.d/gitlab
@@ -20,6 +20,7 @@ APP_USER="git" @@ -20,6 +20,7 @@ APP_USER="git"
20 DAEMON_OPTS="-C $APP_ROOT/config/puma.rb" 20 DAEMON_OPTS="-C $APP_ROOT/config/puma.rb"
21 PID_PATH="$APP_ROOT/tmp/pids" 21 PID_PATH="$APP_ROOT/tmp/pids"
22 SOCKET_PATH="$APP_ROOT/tmp/sockets" 22 SOCKET_PATH="$APP_ROOT/tmp/sockets"
  23 +SOCKET_FILE="$SOCKET_PATH/gitlab.socket"
23 WEB_SERVER_PID="$PID_PATH/puma.pid" 24 WEB_SERVER_PID="$PID_PATH/puma.pid"
24 SIDEKIQ_PID="$PID_PATH/sidekiq.pid" 25 SIDEKIQ_PID="$PID_PATH/sidekiq.pid"
25 STOP_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:stop" 26 STOP_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:stop"
@@ -51,7 +52,7 @@ start() { @@ -51,7 +52,7 @@ start() {
51 exit 1 52 exit 1
52 else 53 else
53 if [ `whoami` = root ]; then 54 if [ `whoami` = root ]; then
54 - execute "rm -f $SOCKET_PATH/gitlab.socket" 55 + ! [ -e $SOCKET_FILE ] || execute "rm $SOCKET_FILE"
55 execute "RAILS_ENV=production bundle exec puma $DAEMON_OPTS" 56 execute "RAILS_ENV=production bundle exec puma $DAEMON_OPTS"
56 execute "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &" 57 execute "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
57 echo "$DESC started" 58 echo "$DESC started"
@@ -65,12 +66,13 @@ stop() { @@ -65,12 +66,13 @@ stop() {
65 if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then 66 if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
66 ## Program is running, stop it. 67 ## Program is running, stop it.
67 kill -QUIT `cat $WEB_SERVER_PID` 68 kill -QUIT `cat $WEB_SERVER_PID`
  69 + ! [ -e $SOCKET_FILE ] || execute "rm $SOCKET_FILE"
68 execute "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &" 70 execute "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &"
69 rm "$WEB_SERVER_PID" >> /dev/null 71 rm "$WEB_SERVER_PID" >> /dev/null
70 echo "$DESC stopped" 72 echo "$DESC stopped"
71 else 73 else
72 ## Program is not running, exit with error. 74 ## Program is not running, exit with error.
73 - echo "Error! $DESC not started!" 75 + echo "Error! $DESC is not started!"
74 exit 1 76 exit 1
75 fi 77 fi
76 } 78 }
@@ -81,7 +83,7 @@ restart() { @@ -81,7 +83,7 @@ restart() {
81 if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then 83 if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
82 echo "Restarting $DESC..." 84 echo "Restarting $DESC..."
83 kill -USR2 `cat $WEB_SERVER_PID` 85 kill -USR2 `cat $WEB_SERVER_PID`
84 - execute "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &" 86 + execute "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1"
85 if [ `whoami` = root ]; then 87 if [ `whoami` = root ]; then
86 execute "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &" 88 execute "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
87 fi 89 fi