#!/bin/sh
# cb 010727

# setup
cd /home/tante/dump/ || exit 1
umask 077

# environment
PATH=/home/tante/bin:/usr/bin:/bin
DATE=`date '+%y%m%d-%H%M%S'`
FILE="tante-dump-$DATE"

# get the password, dump db to file
tante-pw | pg_dump -o -u -f "$FILE" tante 2>&1 | egrep -v '^$|Username: Password:'

# compress it
gzip -9 "$FILE"

# do something with old backups
find . -mtime +25 -print | xargs rm -f
