Skip to content

Instantly share code, notes, and snippets.

@ysh7
Last active June 9, 2022 00:27
Show Gist options
  • Save ysh7/add6ef71a4be708d615e7dca329269cb to your computer and use it in GitHub Desktop.
Save ysh7/add6ef71a4be708d615e7dca329269cb to your computer and use it in GitHub Desktop.
Simple bash script for HAProxy socket interaction
#!/bin/bash
while IFS= read -e -p "haproxy> " cmd;
do
if [ -z "$cmd" ]; then
continue
fi
history -s "$cmd"
case "$cmd" in
quit)
exit 0
;;
clear)
clear
continue
;;
shell)
bash
continue
;;
esac
echo "$cmd" | /bin/socat unix-connect:/var/run/haproxy.sock stdio
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment