# Based on incremental-backup 0.1 by Matteo Mattei
#
# Copyright 2006 Matteo Mattei <matteo.mattei@gmail.com>
- # Copyright 2007, 2008, 2009, 2010, 2011, 2015 Bernie Innocenti <bernie@codewiz.org>
-# Copyright 2007, 2008, 2009, 2010, 2011, 2012 Bernie Innocenti <bernie@codewiz.org>
++# Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2015 Bernie Innocenti <bernie@codewiz.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
MIN_FREE_GB=10
RESULT=500
-DATE=`date +"%Y%m%d"`
+DATE=$(date +"%Y%m%d")
+if [ $(date +"%d") = 1 ]; then
+ DATE="$DATE-monthly"
+elif [ $(date +"%w") = 0 ]; then
+ DATE="$DATE-weekly"
+fi
DEST="`echo $DEST | sed -e 's/\/$//'`"
+ if [ -f "$CONF_FILE" ]; then
+ source /etc/wizbackup/wizbackup.conf
+ fi
# Use "backup" ssh key with ssh protocol, or password file for rsync protocol
if [ "${SRC%:*}" == "rsync" ]; then
# make sure to be root
if (( `id -u` != 0 )); then { echo "Sorry, must be root. Exiting..."; exit; } fi
- echo "$(date): BEGIN backup: $SRC -> $DEST"
+ echo "$(date): BEGIN backup: $0 $@"
echo "$(date): $0 $SRC $DEST $@"
do_init
-do_prune
+do_prune 6 ""
+do_prune 4 "-weekly"
+do_prune $MONTHS "-monthly"
do_test
do_link
do_backup