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