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.

Revisions

  1. ysh7 revised this gist May 15, 2017. No changes.
  2. ysh7 created this gist May 15, 2017.
    25 changes: 25 additions & 0 deletions haproxy-shell
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    #!/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