This commit is contained in:
Jakobus Schürz 2022-08-02 20:02:11 +02:00
parent 5ea462f314
commit 0831f7ed4f

View file

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
set -euo pipefail
function help() { function help() {
cat << EOF cat << EOF
@ -9,12 +11,19 @@ cat << EOF
Usage: $(basename $0) <action> <node> Usage: $(basename $0) <action> <node>
$(basename $0) help $(basename $0) help
<action> [enable|disable|serverstate|showstat|showmaint] <action> enable|disable|serverstate|showstat
<node> Nomenklatur ist <svc><cluster><env><node> (z.B. jra4t1 - Jira, Cluster 4 (ITSM), Test, Node 1) <node> Nomenklatur ist <svc><cluster><env><node> (z.B. jra4t1 - Jira, Cluster 4 (ITSM), Test, Node 1)
<svc> [jra|cnf] 3 characters <svc> [jra|cnf] 3 characters
<cluster> [0-9] 1 character <cluster> [0-9] 1 character
<env> [pte] 1 character <env> [pte] 1 character
<node> [0-9] 1 character <node> [0-9] 1 character
<action> showmaint
<node> Nomenklatur ist <svc><cluster><env> (z.B. jra4t - Jira, Cluster 4 (ITSM), Test)
<svc> [jra|cnf] 3 characters
<cluster> [0-9] 1 character
<env> [pte] 1 character
help zeigt diese Hilfe help zeigt diese Hilfe
EOF EOF
@ -73,7 +82,7 @@ case $COMMAND in
Cluster: $CLUSTER Cluster: $CLUSTER
Loadbalancers: ${LBS[*]} Loadbalancers: ${LBS[*]}
Backend: ${BACKENDS[$i]} Backend: ${BACKENDS[$i]}
What: ${WHAT} What: ${WHAT:-not set}
------------------------------------ ------------------------------------
EOF EOF
@ -91,7 +100,7 @@ EOF
Loadbalancers: ${LBS[*]} Loadbalancers: ${LBS[*]}
Backend: ${BACKENDS[$i]} Backend: ${BACKENDS[$i]}
Server: ${SERVERS[$i]} Server: ${SERVERS[$i]}
What: ${WHAT} What: ${WHAT:-not set}
------------------------------------ ------------------------------------
EOF EOF
@ -99,15 +108,16 @@ EOF
case $ACTION in case $ACTION in
enable|disable) enable|disable)
echo "echo '$ACTION server ${BACKENDS[$i]}/${SERVERS[$i]}'|socat stdio $HAADMINSOCK" echo "echo '$ACTION server ${BACKENDS[$i]}/${SERVERS[$i]}'|socat stdio $HAADMINSOCK"
parallel-ssh -i $(for l in ${LBS[@]};do echo -H $l;done) "echo '$ACTION server ${BACKENDS[$i]}/${SERVERS[$i]}'|socat stdio $HAADMINSOCK" parallel-ssh --inline-stdout $(for l in ${LBS[@]};do echo -H $l;done) "echo '$ACTION server ${BACKENDS[$i]}/${SERVERS[$i]}'|socat stdio $HAADMINSOCK"
;; ;;
show) show)
echo "echo '$ACTION $WHAT ${BACKENDS[$i]}'|socat stdio $HAADMINSOCK" echo "echo '$ACTION $WHAT ${BACKENDS[$i]}'|socat stdio $HAADMINSOCK"
parallel-ssh -i $(for l in ${LBS[@]};do echo -H $l;done) "echo '$ACTION $WHAT ${BACKENDS[$i]}'|socat stdio $HAADMINSOCK" parallel-ssh --inline-stdout $(for l in ${LBS[@]};do echo -H $l;done) "echo '$ACTION $WHAT ${BACKENDS[$i]}'|socat stdio $HAADMINSOCK"
;; ;;
showmaint) showmaint)
UMG=t LBS=( sl${UMG}ebsatlassianlb01 sl${UMG}ebsatlassianlb02 ) # UMG=t LBS=( sl${UMG}ebsatlassianlb01 sl${UMG}ebsatlassianlb02 )
UMG=p LBS=( ${LBS[@]} sl${UMG}ebsatlassianlb01 sl${UMG}ebsatlassianlb02 ) # UMG=p LBS=( ${LBS[@]} sl${UMG}ebsatlassianlb01 sl${UMG}ebsatlassianlb02 )
echo UMG: ${UMG}
echo LBS: ${LBS[@]} echo LBS: ${LBS[@]}
echo "echo '$ACTION $WHAT ${BACKENDS[$i]}'|socat stdio $HAADMINSOCK" echo "echo '$ACTION $WHAT ${BACKENDS[$i]}'|socat stdio $HAADMINSOCK"
parallel-ssh --inline-stdout $(for l in ${LBS[@]};do echo -H $l;done) "echo 'show $WHAT ${BACKENDS[$i]}'|socat stdio $HAADMINSOCK"| awk -F, '$1~/^\[[0-9][0-9]*/ {print $0} $18=="MAINT" {print "backend "$1" - "$2" "$18}' parallel-ssh --inline-stdout $(for l in ${LBS[@]};do echo -H $l;done) "echo 'show $WHAT ${BACKENDS[$i]}'|socat stdio $HAADMINSOCK"| awk -F, '$1~/^\[[0-9][0-9]*/ {print $0} $18=="MAINT" {print "backend "$1" - "$2" "$18}'