Created
October 3, 2011 10:19
-
-
Save jiphex/1258830 to your computer and use it in GitHub Desktop.
Propagate Things by Shell/rsync
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# SERVICES is a space-separated list of services to reload | |
# FILES is a list of configuration files to propagate from localhost to $HOSTS | |
# HOSTS is a list of servers to propagate things to. | |
# | |
# Assumes that some kind of passwordless SSH is already setup. | |
RELOADSERVICES="" | |
RESTARTSERVICES="varnish" | |
FILES="/etc/sysconfig/varnish /etc/varnish/default.vcl /tmp/test.txt /etc/sysctl.conf" | |
HOSTS="10.0.0.1 10.0.0.2 10.0.0.3" | |
for h in $HOSTS; do | |
for f in $FILES; do | |
rsync -vaPh $f root@$h:$f | |
done | |
for s in $RELOADSERVICES; do | |
ssh $h service $s reload | |
done | |
for s in $RESTARTSERVICES; do | |
ssh $h service $s restart | |
done | |
ssh $h sysctl -p | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment