# run this script as root, on deleuze
#
-exec >& /var/log/backup-to-rsync-log
-
PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin
#COMPRESS_EXT=.bz2
#COMPRESS_PROG=bzip2
COMPRESS_PROG=gzip
KEYFILE=/etc/backup-encryption-key
BACKUPTMP=/var/backups/hcoop-backup
-CURDATE=$(date +%Y.%m.%d)
+CURDATE=$(date -u +%Y.%m.%d)
MOVE_OVER=$(dirname $0)/rsync.net-move-over
RSYNCDIR=/vicepa/hcoop-backups/files
rm -fr $RSYNCDIR
mkdir -p $RSYNCDIR/$CURDATE
+chmod og=rx,u=rwx $RSYNCDIR
+chmod og= $RSYNCDIR/$CURDATE
# Initialize backup staging area
mkdir -p $BACKUPTMP
ccrypt -k $KEYFILE -e | \
$MOVE_OVER $CURDATE $F
+# Update file permissions so that rsync.net can access the backups
+chmod -R go=,u-w $RSYNCDIR/$CURDATE
+chmod u+w $RSYNCDIR/$CURDATE
+chown -R rsync $RSYNCDIR/$CURDATE
+
+# Complain to admins if there are unknown files
grep '[a-z/]' complain && \
mail -a 'From: The Backup Program <backups@deleuze.hcoop.net>' \
-s "automated message: annoying files found on deleuze (please do something about them)" admins@hcoop.net \