Skip to content

Commit

Permalink
fix reload failure if admin socket refuses connection
Browse files Browse the repository at this point in the history
The reload script uses the admin socket to read the current haproxy
state, before reloading a new configuration. This state reading would
fail the reload if the socket exists but is refusing connection, eg if
haproxy has died.
  • Loading branch information
jcmoraisjr committed Jan 9, 2021
1 parent dc17e35 commit f9f7478
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rootfs/haproxy-reload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ set -e
HAPROXY_SOCKET=/var/run/haproxy/admin.sock
HAPROXY_STATE=/var/lib/haproxy/state-global
if [ -S $HAPROXY_SOCKET ]; then
echo "show servers state" | socat $HAPROXY_SOCKET - > $HAPROXY_STATE
else
echo "show servers state" | socat $HAPROXY_SOCKET - > /tmp/state && mv /tmp/state $HAPROXY_STATE
fi
if [ ! -s $HAPROXY_STATE ]; then
echo "#" > $HAPROXY_STATE
fi
case "$1" in
Expand Down

0 comments on commit f9f7478

Please sign in to comment.