-
-
Save johncalvinyoung/5315288 to your computer and use it in GitHub Desktop.
Gentoo startup script for unicorn
This file contains hidden or 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
#!/sbin/runscript | |
# unicorn init script for Gentoo Linux | |
APP_ROOT=/var/www/apps/your_app | |
RAILS_ROOT=$APP_ROOT/current | |
USER=your_user | |
extra_commands="reload" | |
depend() { | |
need net | |
} | |
start() { | |
ebegin "Starting unicorn server" | |
start-stop-daemon --start \ | |
--chdir "${RAILS_ROOT}" \ | |
--user "${USER}" \ | |
--pidfile "${RAILS_ROOT}/tmp/pids/unicorn.pid" \ | |
--exec bundle -- exec unicorn_rails -c "${APP_ROOT}/shared/config/unicorn.rb" -E production -D | |
eend $? | |
} | |
stop() { | |
ebegin "Stopping unicorn server" | |
start-stop-daemon --stop \ | |
--chdir "${RAILS_ROOT}" \ | |
--user "${USER}" \ | |
--pidfile "${RAILS_ROOT}/tmp/pids/unicorn.pid" | |
eend $? | |
} | |
reload() { | |
ebegin "Seamlessly restarting unicorn server" | |
kill -USR2 `cat "${RAILS_ROOT}/tmp/pids/unicorn.pid"` | |
eend $? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment