Ниже новомодный сценарий для sidekiq. Рабочая выскочка
sudo service sidekiq start
Получает следующую ошибку
sidekiq: unrecognized service
Следующее sidekiq.conf
содержание
# Just a custom description for our Job
description "Sidekiq Background Worker"
# On which conditions the job should start. In this case it's very simple: On the system startup (this is basically when the system is booted)
#start on startup
start on runlevel [2345]
# On which conditions the job should stop. In this case when the system reboot (http://upstart.ubuntu.com/cookbook/#runlevels)
stop on runlevel [06]
# This are the User and User Group that will be used to run the Job. On our case it should be the user that we have set on our capistrano script for instance.
# You can check at `config/deploy/<environment>.rb` on this line `server <some_ip_addreess>, user: <deploy_user>`
setuid ubuntu
setgid ubuntu
# This indicate that we want to restart the Job if it crashes
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
script
# this script runs in /bin/sh by default
# respawn as bash so we can source in RVM
exec /bin/bash <<EOT
# use syslog for logging
exec &> /dev/kmsg
# Jump into the capistrano deployment directory
cd /home/ubuntu/myproject/
# Start Sidekiq through RVM. Note that I'm using the standard Capistrano paths
exec ~/.rvm/bin/rvm-shell -c 'bundle exec sidekiq -C ./config/sidekiq.yml --environment production --logfile /home/ubuntu/myproject/log/sidekiq.log'
EOT
end script
Никакие журналы не отображены в syslog
.
Можно создать символьную ссылку новомодного файла от/etc/init/sidekiq.conf до/etc/init.d/sidekiq и затем работать sudo service sidekiq start
.
А лучший способ отладить Ваш новомодный сценарий состоит в том, чтобы поместить пред и блок сообщения, как упомянуто здесь http://upstart.ubuntu.com/getting-started.html .
Вот демонстрационный sidekiq.conf https://github.com/mperham/sidekiq/blob/master/examples/upstart/sidekiq.conf.
Помещенный ниже кода в Вашей исполнительной части для отправки всего вывода и ошибок в файл.
exec 2> /tmp/rc.local.log # send stderr from this file to a log file
exec 1>&2 # send stdout to the same log file
set -x