Created
January 26, 2014 23:00
-
-
Save Geesu/8640616 to your computer and use it in GitHub Desktop.
Postgresql replication archive_command
This file contains 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/bash | |
echoerr() { echo "$@" 1>&2; } | |
FAIL=0 | |
`rsync -aq $1 postgres@b:/var/lib/postgresql/9.2/archive/$2` & pid_1=$! ; `rsync -aq $1 postgres@c:/var/lib/postgresql/9.2/archive/$2` & pid_2=$! ; `rsync -aq $1 postgres@d:/var/lib/postgresql/9.2/archive/$2` & pid_3=$! | |
echoerr "Spawned replication processes $pid_1 AND $pid_2 AND $pid_3" | |
wait $pid_1 || let "FAIL+=1" | |
wait $pid_2 || let "FAIL+=1" | |
wait $pid_3 || let "FAIL+=1" | |
if [ "$FAIL" == "0" ]; | |
then | |
echoerr "Replication success $1 $2" | |
else | |
echoerr "Replication failed $1 $2" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment