- Also, locase the local variable names.
COMPRESS_PROG=gzip
KEYFILE=/etc/backup-encryption-key
BACKUPTMP=/var/backups/hcoop-backup-testing
COMPRESS_PROG=gzip
KEYFILE=/etc/backup-encryption-key
BACKUPTMP=/var/backups/hcoop-backup-testing
+CURDATE=$(date +%Y.%m.%d)
MOVE_OVER=$(dirname $0)/s3-move
MOVE_OVER=$(dirname $0)/s3-move
tar clpf - --ignore-failed-read --no-recursion -C / -T backupfiles | \
$COMPRESS_PROG | \
ccrypt -k $KEYFILE -e | \
tar clpf - --ignore-failed-read --no-recursion -C / -T backupfiles | \
$COMPRESS_PROG | \
ccrypt -k $KEYFILE -e | \
# Acquire lock before messing with spamd
COUNT=0
# Acquire lock before messing with spamd
COUNT=0
$COMPRESS_PROG | \
ccrypt -k $KEYFILE -e > $F
rm -f $LOCK
$COMPRESS_PROG | \
ccrypt -k $KEYFILE -e > $F
rm -f $LOCK
+< $F $MOVE_OVER $CURDATE $F
rm -f $F
vos listvol deleuze | \
rm -f $F
vos listvol deleuze | \
"F={}.dump$COMPRESS_EXT.aescrypt ;
vos dump -id {} -localauth -clone |
$COMPRESS_PROG | ccrypt -k $KEYFILE -e |
"F={}.dump$COMPRESS_EXT.aescrypt ;
vos dump -id {} -localauth -clone |
$COMPRESS_PROG | ccrypt -k $KEYFILE -e |
+ $MOVE_OVER $CURDATE \$F"
echo backing up databases
F=databases.tar$COMPRESS_EXT.aescrypt
tar -C /var/backups/databases/ -cf - . | \
$COMPRESS_PROG | \
ccrypt -k $KEYFILE -e | \
echo backing up databases
F=databases.tar$COMPRESS_EXT.aescrypt
tar -C /var/backups/databases/ -cf - . | \
$COMPRESS_PROG | \
ccrypt -k $KEYFILE -e | \
grep '[a-z/]' complain && \
mail -a 'From: The Backup Program <backups@deleuze.hcoop.net>' \
grep '[a-z/]' complain && \
mail -a 'From: The Backup Program <backups@deleuze.hcoop.net>' \
BUCKET=hcoop.net-backups
BACKUPDIR=full
BUCKET=hcoop.net-backups
BACKUPDIR=full
-SUBDIR=$(date +%Y.%m.%d)
S3CMD=$(dirname $0)/s3
IFS=$'\n'
S3CMD=$(dirname $0)/s3
IFS=$'\n'
function move_over () {
# Move file to its offsite destination.
# Expects the file to come from STDIN.
function move_over () {
# Move file to its offsite destination.
# Expects the file to come from STDIN.
- # $1: filename, $2: relative directory (optional)
- if test -z "$1" || test -n "$3"; then
+ # $1: date subdirectory
+ # $2: filename
+ # $3: relative directory (optional)
+ if test -z "$2" || test -n "$4"; then
echo "Bad programming"
exit 1
fi
echo "Bad programming"
exit 1
fi
- local FILE=$1
- local DEST=$BACKUPDIR/$SUBDIR
+ local subdir=$1
+ local file=$2
+ local dest=$BACKUPDIR/$subdir
- split -d -b ${CHUNKSIZE}m - ${FILE}.
- for i in ${FILE}.*; do
- s3_cmd put $DEST/$i $i
+ split -d -b ${CHUNKSIZE}m - ${file}.
+ for i in ${file}.*; do
+ s3_cmd put $dest/$i $i
function prune_old_backups () {
# Implement me
function prune_old_backups () {
# Implement me
local oldpwd=$PWD
cd $BACKUPDIR
find . -mindepth 1 -maxdepth 1 -type d -ctime +7 \
local oldpwd=$PWD
cd $BACKUPDIR
find . -mindepth 1 -maxdepth 1 -type d -ctime +7 \