X-Git-Url: http://git.hcoop.net/clinton/scripts.git/blobdiff_plain/8a24cd39bdac42aa559cb2dfdec7c9fe70b592d2..253d533797c473e091840d3098f7eb98a32202b3:/hcoop-backup diff --git a/hcoop-backup b/hcoop-backup index 113539a..51da992 100755 --- a/hcoop-backup +++ b/hcoop-backup @@ -8,8 +8,6 @@ # 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 @@ -17,7 +15,7 @@ COMPRESS_EXT=.gz 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 @@ -27,6 +25,8 @@ IFS=$'\n' 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 @@ -162,6 +162,12 @@ tar -C /var/backups/databases/ -cf - . | \ 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 ' \ -s "automated message: annoying files found on deleuze (please do something about them)" admins@hcoop.net \