deploy_script_using_case
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Last revision | |||
— | deploy_script_using_case [2011/04/26 16:53] – created jt | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Deploy Script Using Case ====== | ||
+ | This script is meant to be used for varnish, but can be adapted for anything. | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | |||
+ | ## deploy-varnish.sh | ||
+ | ## deploy default.vcl and/or reload varnish daemon on all hosts | ||
+ | |||
+ | if [ $# -lt 1 ] | ||
+ | then | ||
+ | echo "Usage : $0 {deploy|deployall|reload|reloadall}" | ||
+ | exit 1 | ||
+ | fi | ||
+ | |||
+ | case " | ||
+ | deploy) | ||
+ | while read -r host | ||
+ | do | ||
+ | cat conf/ | ||
+ | done < <(head -n1 hosts) | ||
+ | echo " | ||
+ | ;; | ||
+ | deployall) | ||
+ | while read -r host | ||
+ | do | ||
+ | cat conf/ | ||
+ | done < hosts | ||
+ | echo " | ||
+ | ;; | ||
+ | reload) | ||
+ | while read -r host | ||
+ | do | ||
+ | ssh $host 'sudo /bin/sh -c "/ | ||
+ | echo " | ||
+ | done < <(head -n1 hosts) | ||
+ | ;; | ||
+ | reloadall) | ||
+ | read -r -p "Are you sure? [Y/n] " response | ||
+ | if [[ $response == " | ||
+ | then | ||
+ | while read -r host | ||
+ | do | ||
+ | ssh $host 'sudo /bin/sh -c "/ | ||
+ | done < hosts | ||
+ | echo " | ||
+ | else | ||
+ | echo " | ||
+ | fi | ||
+ | ;; | ||
+ | |||
+ | esac | ||
+ | |||
+ | </ |
deploy_script_using_case.txt · Last modified: 2020/08/10 02:35 by 127.0.0.1