Last active
June 9, 2022 00:27
-
-
Save ysh7/add6ef71a4be708d615e7dca329269cb to your computer and use it in GitHub Desktop.
Simple bash script for HAProxy socket interaction
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
| #!/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