Ruby

用暴發戶執行 gitlab sidekiq(rake 任務)

  • July 18, 2013

我正在嘗試通過新貴啟動 gitlab sidekiq 守護程序。但不幸的是,sidekiq 工作人員似乎重新生成了,因為 sidekiq start 對自身進行了惡魔化:

Jul 12 17:26:42 git kernel: [370722.042968] init: gitlab-sidekiq main process (28251) terminated with status 1
Jul 12 17:26:42 git kernel: [370722.042997] init: gitlab-sidekiq main process ended, respawning

有沒有辦法“取消妖魔化”一個 rake 任務?(我知道這個這個)或者專門執行 gitlab sidekiq 作為新貴腳本。到目前為止,這是我目前的工作:

description "Sidekiq Background Worker for Gitlab"

# no "start on", we don't want to automatically start
start on runlevel [2345]
stop on runlevel [!2345]

# change to match your deployment user
setuid git
setgid git

env HOME=/home/git
env PATH="/usr/local/rvm/gems/ruby-1.9.3-p429@gitlab/bin:/usr/local/rvm/gems/ruby-1.9.3-p429/bin:/usr/local/rvm/gems/ruby-1.9.3-p429@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p429/bin:/usr/local/rvm/bin:/usr/bin:/bin"
env GEM_PATH="/usr/local/rvm/gems/ruby-1.9.3-p429@gitlab:/usr/local/rvm/gems/ruby-1.9.3-p429@global"
env RAILS_ENV="production"
respawn
respawn limit 3 30

script
# this script runs in /bin/sh by default
 cd /home/git/gitlab
 exec bundle exec rake sidekiq:start
end script

我能夠修復腳本。由於 sidekiq:start 對自身進行了去魔化,我需要將其放入啟動後和停止後的環境中。

# /etc/init/gitlab-sidekiq.conf - Sidekiq config for gitlab

# use the service command:
#   sudo service gitlab-sidekiq {start,stop,restart,status}

description "Sidekiq Background Worker for Gitlab"

start on runlevel [2345]
stop on runlevel [!2345]

# change to match your deployment user
setuid git
setgid git

env HOME=/home/git
env PATH="/usr/local/rvm/gems/ruby-1.9.3-p429@gitlab/bin:/usr/local/rvm/gems/ruby-1.9.3-p429/bin:/usr/local/rvm/gems/ruby-1.9.3-p429@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p429/bin:/usr/local/rvm/bin:/usr/bin:/bin"
env GEM_PATH="/usr/local/rvm/gems/ruby-1.9.3-p429@gitlab:/usr/local/rvm/gems/ruby-1.9.3-p429@global"
env RAILS_ENV="production"

post-start script
 cd /home/git/gitlab
 exec bundle exec rake sidekiq:start
end script


post-stop script
 cd /home/git/gitlab
 exec bundle exec rake sidekiq:stop
end script

引用自:https://serverfault.com/questions/522890