Created
December 12, 2014 17:50
-
-
Save tanema/2609264682a0c8606733 to your computer and use it in GitHub Desktop.
Rails and haproxy in one script for our front end guy
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 | |
# used for kill signals | |
kill_rails () { | |
kill -6 ${rails_pid} > /dev/null 2>&1 | |
} | |
#get password for haproxy | |
read -s -p "Enter Password: " proxy_pass | |
echo "" | |
#allows ctrl c to work in the while loop | |
trap kill_rails SIGINT SIGHUP SIGTERM | |
#start the processes | |
rails s & | |
rails_pid=($!) | |
#we wait on haproxy while rails runs in bg | |
echo $proxy_pass | sudo -S haproxy -f ./config/haproxy.cfg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sweet!