Skip to content

Instantly share code, notes, and snippets.

@vitormil
Last active December 30, 2015 17:19
Show Gist options
  • Save vitormil/7860560 to your computer and use it in GitHub Desktop.
Save vitormil/7860560 to your computer and use it in GitHub Desktop.
/etc/init/<file>.conf
description "Myapp web application"
start on starting myapp
stop on stopping myapp
respawn
exec su - myapp -c 'cd /var/www/myapp/current/ && bundle exec unicorn -c ./config/unicorn.rb --env production >> /var/log/myapp/web.log 2>&1'
description "Myapp worker"
start on starting myapp
stop on stopping myapp
respawn
exec su - myapp -c 'cd /var/www/myapp/current/ && bundle exec sidekiq >> /var/log/myapp/worker.log 2>&1'
description "Myapp web application"
start on runlevel [2345]
stop on runlevel [016]
pre-start script
mkdir -p /var/log/myapp
chown -R myapp. /var/log/myapp
mkdir -p /var/run/myapp
chown -R myapp. /var/run/myapp
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment