I have problems with my sidekiq daemon restart. Upstart is not respawning the daemon when the daemon crashes. Here is my Upstart init file.
description "Sidekiq worker"
start on runlevel [2345]
stop on runlevel [06]
# change to match your deployment user
setuid user
setgid user
env HOME=/home/user
# restart the process if it crashes
respawn
# respawn a max of 3 times within 30 seconds
respawn limit 3 30
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 /home/user/.rvm/bin/rvm
cd /var/www/myapp/current
exec sidekiq -c 10 -e production -L log/sidekiq.log -d
EOT
end script
When I start daemon with Sercive start, it works but It not respawn if kill it.
Remove -L log/sidekiq.log -d
. You do not use custom logfiles or daemonize with Upstart.