OSDN Git Service

Only kill sidekiqs belonging to gitlab user
authorJacob Vosmaer <contact@jacobvosmaer.nl>
Fri, 4 Oct 2013 09:18:44 +0000 (11:18 +0200)
committerJacob Vosmaer <contact@jacobvosmaer.nl>
Fri, 4 Oct 2013 09:25:44 +0000 (11:25 +0200)
lib/tasks/gitlab/check.rake

index 6e2a59f..531b01c 100644 (file)
@@ -289,7 +289,6 @@ namespace :gitlab do
     ########################
 
     def check_gitlab_git_config
-      gitlab_user = Gitlab.config.gitlab.user
       print "Git configured for #{gitlab_user} user? ... "
 
       options = {
@@ -664,8 +663,8 @@ namespace :gitlab do
         puts "#{sidekiq_match.length}".red
         try_fixing_it(
           'sudo service gitlab stop',
-          'sudo pkill -f sidekiq',
-          'sleep 10 && sudo pkill -9 -f sidekiq',
+          "sudo pkill -u #{gitlab_user} -f sidekiq",
+          "sleep 10 && sudo pkill -9 -u #{gitlab_user} -f sidekiq",
           'sudo service gitlab start'
         )
         fix_and_rerun
@@ -709,10 +708,13 @@ namespace :gitlab do
   end
 
   def sudo_gitlab(command)
-    gitlab_user = Gitlab.config.gitlab.user
     "sudo -u #{gitlab_user} -H #{command}"
   end
 
+  def gitlab_user
+    Gitlab.config.gitlab.user
+  end
+
   def start_checking(component)
     puts "Checking #{component.yellow} ..."
     puts ""