Added --delete option for backups

This commit is contained in:
deajan 2015-01-08 17:16:57 +01:00
parent 7c9f3f4d73
commit dd9d3dc982
3 changed files with 16 additions and 3 deletions

View File

@ -22,6 +22,7 @@ UNDER WORK
CHANGELOG
---------
- Added delete on destination option for files that vanished from source
- Fixed ignoring compression level in conf file
- Fixed dry mode sql backup output
- Prevented triggering TrapError if there are no child processes to terminate on TrapQuit

View File

@ -2,7 +2,7 @@
###### Remote (or local) backup script for files & databases
###### (L) 2013 by Ozy de Jong (www.netpower.fr)
###### Config file rev 2711201401
###### Config file rev 0801201501
## ---------- GENERAL BACKUP OPTIONS
@ -139,6 +139,9 @@ HARD_MAX_EXEC_TIME_FILE_TASK=7200
## Keep partial uploads that can be resumed on next run, experimantal feature
PARTIAL=no
## Delete files on destination that vanished from source. Do not turn this on unless you enabled backup rotation or a snapshotting FS like zfs to keep those vanished files on the destination.
DELETE_VANSIHED_FILES=no
## ---------- ALERT OPTIONS
## Alert email adresses separated by a space character

View File

@ -5,7 +5,7 @@
AUTHOR="(L) 2013-2014 by Orsiris \"Ozy\" de Jong"
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
PROGRAM_VERSION=1.84RC4
PROGRAM_BUILD=2112201402
PROGRAM_BUILD=0801201501
## type doesn't work on platforms other than linux (bash). If if doesn't work, always assume output is not a zero exitcode
if ! type -p "$BASH" > /dev/null
@ -1280,6 +1280,11 @@ function Init
RSYNC_EXCLUDE="$RSYNC_EXCLUDE --exclude=\"$PARTIAL_DIR\""
fi
if [ "DELETE_VANSIHED_FILES" == "yes" ]
then
SYNC_OPTS=$SYNC_OPTS" --delete"
fi
if [ $stats -eq 1 ]
then
SYNC_OPTS=$SYNC_OPTS" --stats"
@ -1424,7 +1429,8 @@ function Usage
echo "--verbose: adds command outputs"
echo "--stats Adds rsync transfer statistics to verbose output"
echo "--partial Allows rsync to keep partial downloads that can be resumed later (experimental)"
echo "--no-maxtime: disables any soft and hard execution time checks"
echo "--no-maxtime disables any soft and hard execution time checks"
echo "--delete Deletes files on destination that vanished on source"
exit 128
}
@ -1470,6 +1476,9 @@ do
--no-maxtime)
no_maxtime=1
;;
--delete)
DELETE_VANSIHED_FILES="yes"
;;
--help|-h|--version|-v)
Usage
;;