Search code examples
ubuntuservicesidekiq

Sidekiq service not starting


I'm trying to start Sidekiq on Ubuntu 16.04.2 but whenever I run sudo service sidekiq start I get back the following error:

Failed to start sidekiq.service: Unit sidekiq.service not found.

My configuration is nothing weird. There's a stock-standard sidekiq.conf file in /etc/init:

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

description "Sidekiq Background Worker"

setuid deploy
setgid deploy
env HOME=/home/deploy

respawn
respawn limit 3 30

normal exit 0 TERM

instance $index

script
exec /bin/bash <<'EOT'
  source /home/deploy/.bashrc
  cd /home/deploy/

  exec bundle exec sidekiq -i ${index} -e production
EOT
end script

There's also a standard workers.conf file in the same directory:

# /etc/init/workers.conf - manage a set of Sidekiqs

description "manages the set of sidekiq processes"

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

env NUM_WORKERS=1

pre-start script
  for i in `seq 1 ${NUM_WORKERS}`
  do
    start sidekiq index=$i
  done
end script

post-stop script
  for i in `seq 1 ${NUM_WORKERS}`
  do
    stop sidekiq index=$i
  done
end script

I've tried to source /home/deploy/.bashrc but that hasn't changed anything. What am I missing?


Solution

  • /etc/init is for Upstart. 16.04 uses systemd.