OSDN Git Service

init.d: Ensure socket is removed before starting service
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Tue, 28 May 2013 14:08:21 +0000 (17:08 +0300)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Tue, 28 May 2013 14:09:01 +0000 (17:09 +0300)
lib/support/init.d/gitlab

index 4c5499b..f4ca07b 100644 (file)
@@ -2,7 +2,7 @@
 
 # GITLAB
 # Maintainer: @randx
-# App Version: 5.1
+# App Version: 5.2
 
 ### BEGIN INIT INFO
 # Provides:          gitlab
@@ -19,6 +19,7 @@ APP_ROOT="/home/git/gitlab"
 APP_USER="git"
 DAEMON_OPTS="-C $APP_ROOT/config/puma.rb"
 PID_PATH="$APP_ROOT/tmp/pids"
+SOCKET_PATH="$APP_ROOT/tmp/sockets"
 WEB_SERVER_PID="$PID_PATH/puma.pid"
 SIDEKIQ_PID="$PID_PATH/sidekiq.pid"
 STOP_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:stop"
@@ -50,6 +51,7 @@ start() {
     exit 1
   else
     if [ `whoami` = root ]; then
+      execute "rm $SOCKET_PATH/gitlab.socket"
       execute "RAILS_ENV=production bundle exec puma $DAEMON_OPTS"
       execute "mkdir -p $PID_PATH && $START_SIDEKIQ  > /dev/null  2>&1 &"
       echo "$DESC started"