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 | |
# | |
# This function asks the user to confirm an action with No used as a default | |
# answer. | |
confirm() | |
{ | |
while true; do | |
read -p "$1" RES | |
case "$RES" in |
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
frontend main *:80 | |
acl is_foo hdr_dom(host) -i foo | |
acl is_bar hdr_dom(host) -i bar | |
use_backend app_foo if is_foo | |
use_backend app_bar if is_bar | |
backend app_foo | |
# app_foo settings go here | |
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 | |
# | |
# This creates a temporary file and sets up a trap handler so that it gets | |
# deleted when the script exits. | |
BASENAME=$(which basename) | |
MKTEMP=$(which mktemp) | |
RM=$(which rm) | |
TMP_PREFIX=$($BASENAME "$0") |
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
frontend main *:80 | |
acl is_http hdr(X-Forwarded-Proto) http | |
redirect prefix https://example.com code 301 if is_http |
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 | |
# | |
# The trick here is to dump pids of all haproxy processes into a file | |
# (-p option) and then tell them to finish their work and exit (-sf). | |
HAPROXY=/usr/sbin/haproxy | |
HAPROXY_PID=/var/run/haproxy.pid | |
HAPROXY_CONFIG=/etc/haproxy/haproxy.cfg | |
$HAPROXY -f $HAPROXY_CONFIG -p $HAPROXY_PID -sf $(cat $HAPROXY_PID) |