> I'm another one of those people... so I wrote a quick & dirty c program to
> vacuum ALL my databases. I just mailed it to Marc Fournier
> (scrappy@hub.org) because I didn't know what to do with it, but if anyone
> else wants it just drop me a line directly.
I do this to vacuum and back up all of my databases every day.
#!/bin/sh
cat <<EOF
*
* Vacuuming databasen at `date`
*
EOF
(
for host in dbserver1 dbserver2
do
echo "Doing host $host"
PSQL="/usr/local/pgsql/bin/psql -h $host"
PDUMP="/usr/local/pgsql/bin/pg_dump -h $host"
CI=/usr/local/bin/ci
cd $HOME/bak/$host
for i in `$PSQL -t -c "select datname from pg_database" template1`
do
echo "Vacuuming $i ..."
$PSQL -c "vacuum analyze;" $i
if [ -f RCS/$i,v.gz ]
then
/usr/local/bin/gzip -d RCS/$i,v.gz
fi
$PDUMP -f$i $i
$CI -l -m"backup" $i
rm $i
if [ -f RCS/$i,v ]
then
ls -l RCS/$i,v
/usr/local/bin/gzip -9 RCS/$i,v &
else
echo "Oops! ci broke somehow."
fi
done
echo "Waiting for all the gzips to finish..."
df .
wait
done
)
--
SA, software.net My girlfriend asked me which one I like better.
pub 1024/3CAE01D5 1994/11/03 Dustin Sallings <dustin@spy.net>
| Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE
L_______________________ I hope the answer won't upset her. ____________