Created
August 1, 2012 16:34
-
-
Save lihanli/3228539 to your computer and use it in GitHub Desktop.
unicorn upstart script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -u | |
set -e | |
APP_NAME='myapp' | |
APP_ROOT="/home/ubuntu/$APP_NAME" | |
PID="$APP_ROOT/tmp/pids/unicorn.pid" | |
ENV=production | |
GEM_HOME="/home/ubuntu/.rvm/gems/ruby-1.9.3-p194" | |
UNICORN_OPTS="-E $ENV -c $APP_ROOT/config/unicorn.rb -D" | |
SET_PATH="cd $APP_ROOT; rvm use 1.9.3-p194; export GEM_HOME=$GEM_HOME" | |
CMD="$SET_PATH; bundle exec unicorn_rails $UNICORN_OPTS" | |
su - ubuntu -c "$CMD"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "unicorn" | |
start on (local-filesystems and net-device-up IFACE=eth0) | |
stop on runlevel [016] | |
console output | |
exec /home/ubuntu/scripts/init_unicorn.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment