Page History
...
Code Block | ||||
---|---|---|---|---|
| ||||
#!/bin/bash # set common options for connection to the JS7 REST Web Service request_options=(--url=http://joc-2-0-primary.sos:7446 --user=root --password=root --ca-cert=./root-ca.crt --controller-id=controller --agent-cluster) # hosts to be patched hosts=(joc-2-0-primary joc-2-0-secondary controller-2-0-primary controller-2-0-secondary diragent-2-0-primary diragent-2-0-secondary) # max. number of tries in case of non-fatal problems tries=3 # delay in seconds between retries after non-fatal problems delay=15 for host in "${hosts[@]}"; do echo "--------------------------------------------------------" echo "CHECKING IMPACT OF HOST SHUTDOWN: $host" echo "--------------------------------------------------------" try=1 while [ "$try" -le "$tries" ]; do echo "" echo "TRY $try/$tries: ./bin/operate-joc.sh health-check "${request_options[@]}" --whatif-shutdown=$host" echo "" ./bin/operate-joc.sh health-statuscheck "${request_options[@]}" --whatif-shutdown="$host" rc=$? echo -n "" case "$rc" in 0) break; ;; 3) sleep "$delay" ;; *) exit "$rc" ;; esac try=$((try+1)) done if [ "$rc" -eq 0 ] then echo "PATCH CAN BE APPLIED TO HOST: $host" # add your code for patching else echo "PATCH CANNOT BE APPLIED TO HOST: $host, Exit Code: $rc" # add your code for error handling fi echo "" done |
...
Overview
Content Tools