Skip to content

Instantly share code, notes, and snippets.

@nicopaez
Last active August 29, 2015 14:11
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save nicopaez/f00d3a219bd3c0d15719 to your computer and use it in GitHub Desktop.
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