Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
upstart config for clockwork
# /etc/init/clockwork.conf - Clockwork 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.
#
# Use the service command:
# sudo service clockwork {start,stop,restart,status}
#
description "Clockwork Background Worker"
# no "start on", we don't want to automatically start
stop on (stopping workers or runlevel [06])
# change to match your deployment user
setuid worker
setgid worker
env HOME=/home/worker
respawn
respawn limit 3 30
# 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 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/worker/.profile
# OR system:
# source /etc/profile.d/rbenv.sh
#
# rvm
# source /home/apps/.rvm/scripts/rvm
# Logs out to /var/log/upstart/sidekiq.log by default
cd /var/www/app_dir
exec bundle exec clockwork clock.rb
EOT
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment