2015-12-23 124 views
2

我閱讀整個互聯網,但不能這樣做。需要啓動VDS(Ubuntu 14.04)上的Sidekiq啓動。我發現和使用這個:在系統啓動時啓動Sidekiq。 Ubuntu 14.04

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

# This example config should work with Ubuntu 12.04+. It 
# allows you to manage multiple Sidekiq instances with 
# Upstart, Ubuntu's native service management tool. 
# 
# See workers.conf for how to manage all Sidekiq instances at once. 
# 
# Save this config as /etc/init/sidekiq.conf then manage sidekiq with: 
# sudo start sidekiq index=0 
# sudo stop sidekiq index=0 
# sudo status sidekiq index=0 
# 
# Hack Upstart's reload command to 'quiet' Sidekiq: 
# 
# sudo reload sidekiq index=0 
# 
# or use the service command: 
# sudo service sidekiq {start,stop,restart,status} 
# 

description "Sidekiq Background Worker" 

start on startup 

#start on runlevel [2345] 
stop on runlevel [06] 

#start on startup 


# change to match your deployment user 
setuid me 
setgid me 
env HOME=/home/me 

respawn 
respawn limit 3 30 

# TERM is sent by sidekiqctl when stopping sidekiq. Without declaring these as 
# normal exit codes, it just respawns. 
normal exit 0 TERM 

# Older versions of Upstart might not support the reload command and need 
# this commented out. 
reload signal USR1 

instance $index 

    script 
# this script runs in /bin/sh by default 
# respawn as bash so we can source in rbenv 
exec /bin/bash <<'EOT' 
    # Pick your poison :) Or none if you're using a system wide installed Ruby. 
    # rbenv 
    # source /home/apps/.bash_profile 
    # OR 
    # source /home/apps/.profile 
    # OR system: 
    # source /etc/profile.d/rbenv.sh 
    # 
    rvm 
    source /usr/local/rvm/scripts/rvm 

    # Logs out to /var/log/upstart/sidekiq.log by default 

    cd /var/www/vk_c_watcher/code 
    exec bundle exec sidekiq -i ${index} -e production 
EOT 
end script 

添加後,我可以啓動與start sidekiq app="/var/www/vk_c_watcher/code" index=0 Sidekiq。但重啓後,進程列表中沒有Sidekiq。

+0

nobilik,你有沒有得到這個解決? –

+0

@JaredMenard還沒有,但想想試試運行級別。我忙於其他事情。 – nobilik

+0

如果我想出一個解決方案,我會在這裏發佈答案。 –

回答

0

感謝Mike Perham的幫助。我只是使用了錯誤的腳本。隨着this script Sidekiq開始啓動。

0

startup事件在系統剛開始時被觸發,當時沒有可寫入的文件系統或網絡,可能它嘗試啓動,但崩潰甚至無法記錄。

運行它晚了一點,例如在運行級別2時,將觸發其他依賴已經開始了一些自定義事件(Redis的,數據庫等)

而且註釋掉# rvm回來,這不是一個命令,但與source ...下一行的標籤。

+0

for'#rvm'我已經看到它了。謝謝。其他的事情會嘗試。 – nobilik

相關問題