> -----Original Message-----
> From: Aage J. Skjolingstad [mailto:aages@aajs.com]
> Sent: 04 November 2000 19:30
> To: pgsql-interfaces@postgresql.org
> Subject: [INTERFACES] Cron job doing VACUUM and BACUP from root
>
>
> Have been searching around the last two days to find some scripts or
> cron jobs to automate backup and vacuum.
>
> I'm running a small db on PSQL 7.02 / RH 7 and keeping my login as
> root.
>
I run the following (extremely basic) script on RH6 with PostgreSQL 7.0.1:
HTH, Regards
Dave.
---------->
#! /bin/sh
cd /
rm /var/log/backup.old
mv /var/log/backup.log /var/log/backup.old
echo Subject: backup results >> /var/log/backup.log
echo >> /var/log/backup.log
echo Mephesto Auto-Backup started: `date` >> /var/log/backup.log
echo >> /var/log/backup.log
echo Vacuuming Database... >> /var/log/backup.log
su - postgres -c "/usr/local/pgsql/bin/psql alarm -c vacuum;"
su - postgres -c "/usr/local/pgsql/bin/psql helpdesk -c vacuum;"
su - postgres -c "/usr/local/pgsql/bin/psql insurance -c vacuum;"
su - postgres -c "/usr/local/pgsql/bin/psql intranet -c vacuum;"
su - postgres -c "/usr/local/pgsql/bin/psql mailtraq -c vacuum;"
su - postgres -c "/usr/local/pgsql/bin/psql pbx -c vacuum;"
su - postgres -c "/usr/local/pgsql/bin/psql sitedev -c vacuum;"
echo Dumping Database... >> /var/log/backup.log
rm /disk1/archive.old
mv /disk1/archive.sql /disk1/archive.old
su - postgres -c "/usr/local/pgsql/bin/pg_dumpall > /disk1/archive.sql"
chown root.root /disk1/archive.sql
chmod 600 /disk1/archive.sql
echo Done. >> /var/log/backup.log
echo Starting TAR dump to DAT... >> /var/log/backup.log
echo >> /var/log/backup.log
tar cf /dev/st0 -W -P /bin /boot /disk1 /etc /home /lib /mnt /root /sbin
/usr /var >> /var/log/backup.log
echo >> /var/log/backup.log
echo Backup completed: `date` >> /var/log/backup.log
/usr/sbin/sendmail root@vale-housing.co.uk < /var/log/backup.log