- Comment
DescriptionwheeeSites posted to: None - DescriptionEveryone hates it that I'm sick and not doing well.Sites posted to: NoneClogs posted to: None
- #!/bin/sh
# John Menerick
hosts="62.65.130.180 62.65.130.181"
opts="-p 6543 -U postgres"
tmpdir="$(mktemp -d /tmp/iuaeiueve.XXXXXXXXXXXXXXXX)"
lasthost=""
for host in $hosts; do
psql $opts -h "$host" -l | \
awk 'BEGIN { getline; getline } $2 ~ /\|/ { print $1 }' \
> "$tmpdir/db.$host"
if [ "$lasthost" ]; then
echo "Comparing DBs from $lasthost and $host"
diff -u "$tmpdir/db.$lasthost" "$tmpdir/db.$host"
fi
lasthost="$host"
done
for db in $(cat "$tmpdir/db.$lasthost"); do
echo "Comparing Database $db ..."
echo '\d' | psql $opts -h "$lasthost" "$db" | \
awk '$5 ~ /table/ { print $3 }' > "$tmpdir/tables.$lasthost"
while read table; do
echo -n "Comparing $db table $table ... "
lastcount=""
lasthost=""
allcount=""
for host in $hosts; do
echo -n "${host} ... "
count="$(echo "select count(*) from $table" | \
psql $opts -h "$host" "$db" | \
awk 'BEGIN { getline; getline } { print $0; exit 0 }')"
allcount="$allcount $count"
if [ "$lastcount" ]; then
if [ "$lastcount" -ne "$count" ]; then
echo "mismatch: $lasthost \($lastcount\) != $host \($count\)"
fi
fi
lasthost="$host"
done
echo "$allcount"
done < "$tmpdir/tables.$lasthost"
done
rm -rf "$tmpdir"Sites posted to: NoneClogs posted to: None - DescriptionOn a flight to IndiaSites posted to: NoneClogs posted to: None
- DescriptionYay for OmSites posted to: NoneClogs posted to: None
- DescriptionThe weekly post of the month.Sites posted to: NoneClogs posted to: None
- DescriptionOMG HAI GUYS!Sites posted to:Clogs posted to: None
- DescriptionArtSites posted to: NoneClogs posted to: None
- Sites posted to: NoneClogs posted to: None
- DescriptionHow we grow. Every year, since high school, I have lost two people close to me. Not even half-way through the year, I have lost three. Ugh.Sites posted to: NoneClogs posted to: None
My Community Blog Subscriptions
-
Find the best content of outdoor a..
-
Post some of your favorite pieces ..
-
The best place to post your conten..
-
This clog is all about John.
-
CellSpin general community
advertisement
advertisement
advertisement

