Skip to content

Instantly share code, notes, and snippets.

@phamonyut
Created December 19, 2015 03:40
Show Gist options
  • Save phamonyut/8a3e96b7f3a0bd9675ab to your computer and use it in GitHub Desktop.
Save phamonyut/8a3e96b7f3a0bd9675ab to your computer and use it in GitHub Desktop.
ตัวอย่าง upstart script
#/etc/init/<your_app>.conf
description "Your App"
author "Phamon <phamonyut@gmail.com>"
start on virtual-filesystems
stop on runlevel [06]
env PATH=/opt/www/<your_app>/current/bin:/usr/local/rbenv/shims:/usr/local/rbenv/bin:/usr/local/bin:/usr/bin:/bin
env RAILS_ENV=production
env RACK_ENV=production
setuid deployer
setgid admin
chdir /opt/www/<your_app>/current
pre-start script
exec >/home/deployer/log/upstart-<your_app>.log 2>&1
exec bundle exec unicorn -D -c /opt/www/<your_app>/current/config/unicorn.rb --env production
end script
post-stop script
exec kill `cat /opt/www/<your_app>/shared/tmp/pids/unicorn.<your_app>.pid`
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment