2015-12-23 88 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

相关问题