/usr/share/gforge/cronjobs/gforge-db-backup.sh is in gforge-db-postgresql 5.3.2+20141104-3+deb8u3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #!/bin/sh
# This script does personal backups to a rsync backup server. You will end up
# with a 7 day rotating incremental backup. The incrementals will go
# into subdirectories named after the day of the week, and the current
# full backup goes into a directory called "current"
if [ $(id -u) != 0 ] ; then
echo "You must be root to run this, please enter passwd"
exec su -c "$0 $1"
fi
# directory to backup
data_path=$(forge_get_config data_path)
chroot=$(forge_get_config chroot)
BDIR="$chroot /var/lib/mailman /etc"
PATTERNS="mailman postgresql exim4 gforge"
DEST="$data_path/backup"
# BACKUPDIR=`date --date yesterday +%A`
BACKUPDIR=`date +%A`
# BACKUPDIR=`date --date tomorrow +%A`
# BACKUPDIR=`date --date "2 days" +%A`
OPTS="--force --ignore-errors --delete --backup --backup-dir=$DEST/$BACKUPDIR -a"
[ ! -d ${DEST} ] && mkdir ${DEST}
[ ! -d ${DEST}/postgres ] && mkdir ${DEST}/postgres
[ ! -d ${DEST}/debconf ] && mkdir ${DEST}/debconf
echo "Backuping data from $BDIR"
# the following line clears the last weeks incremental directory
[ -d $DEST/emptydir ] || mkdir $DEST/emptydir
rsync --delete -a $DEST/emptydir/ $DEST/$BACKUPDIR/
rmdir $DEST/emptydir
# now the actual transfer
rsync $OPTS $BDIR $DEST/current
export FUSIONFORGE_NO_PLUGINS=true
COMPRESSOR=$($(forge_get_config binary_path)/forge_get_compressor)
EXTENSION=$($(forge_get_config binary_path)/forge_get_compressed_extension)
echo "Dumping database"
su -s /bin/bash postgres -c "pg_dump -F c -d gforge" | $COMPRESSOR > ${DEST}/postgres/gforge.dump${EXTENSION}
echo "Dumping debconf keys"
for PAT in $PATTERNS
do
debconf-copydb configdb stdout -c Name:stdout -c Driver:Pipe -c InFd:none \
--pattern='^'${PAT}'/' > ${DEST}/debconf/${PAT}.txt
chmod 0700 ${DEST}/debconf/${PAT}.txt
done
|