Skip to content

Instantly share code, notes, and snippets.

@ueno1969
Last active January 26, 2023 08:38
Show Gist options
  • Save ueno1969/ade8eb7234aa38fc0605a47464209c59 to your computer and use it in GitHub Desktop.
Save ueno1969/ade8eb7234aa38fc0605a47464209c59 to your computer and use it in GitHub Desktop.
pountctl support

使い方

一覧表示

pctrl.sh l

無効化

pctrl.sh d [parameters]

有効化

pctrl.sh e [parameters]

#! /bin/bash
set -eu
CMD="sudo /usr/local/pound/sbin/poundctl -c /var/run/pound/poundctl.socket "
if [ $# -eq 0 ] ; then
echo "Uasge $0 [e|d|l]"
exit 1;
fi
case "$1" in
e*)
echo "Enable backend $2 $3 $4"
$CMD -B $2 $3 $4
;;
d*)
echo "Disable backend $2 $3 $4"
$CMD -b $2 $3 $4
;;
*)
$CMD -H | awk '
tolower($0) ~ /^ [- 0-9]*\. (https? listener|global)/ {l=$1}
tolower($0) ~ /^ [- 0-9]*\. service/ {m=$1}
tolower($0) ~ /^ [- 0-9]*\. backend/ {n=$1; $1="";s=l""m""n; gsub(/[ .]+/, " ", s); print s,$0 }
'
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment