From 45633d136236334aa5d4425873ca3b7a0f31ce5a Mon Sep 17 00:00:00 2001 From: deajan Date: Thu, 12 Feb 2015 11:46:54 +0100 Subject: [PATCH] Prevent exclude pattern wildcard globbing --- CHANGELOG.md | 1 + host_backup.conf | 24 ++++++++++++------------ obackup.sh | 5 ++++- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df882f3..dc1375f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ UNDER WORK CHANGELOG --------- +- Prevent exclude pattern globbing before the pattern reaches the rsync cmd - Fixed some typos with ported code from osync rendering stats and partial downloads unusable - Added delete on destination option for files that vanished from source - Fixed ignoring compression level in conf file diff --git a/host_backup.conf b/host_backup.conf index 838f296..2beae0a 100755 --- a/host_backup.conf +++ b/host_backup.conf @@ -70,14 +70,14 @@ REMOTE_3RD_PARTY_HOSTS="www.kernel.org www.google.com" ## Database backup user SQL_USER=backupuser -## Enabling the following option will save all databases on local or remote given SQL instance except the ones specified in the exlude list. +## Enabling the following option will save all databases on local or remote given SQL instance except the ones specified in the exclude list. ## Every found database will be backed up as separate backup task. DATABASES_ALL=yes DATABASES_ALL_EXCLUDE_LIST="test;mysql" -## Alternatively, if DATABASES_ALL=no, you can specifiy a list of databases to backup separated by spaces. +## Alternatively, if DATABASES_ALL=no, you can specify a list of databases to backup separated by spaces. DATABASES_LIST="" -## Max backup execution time per Database task. Soft max exec time generates a warning only. Hard max ecec time generates a warning and stops current backup task. +## Max backup execution time per Database task. Soft max exec time generates a warning only. Hard max exec time generates a warning and stops current backup task. ## If a task gets stopped, next one in the task list gets executed. Time is specified in seconds. SOFT_MAX_EXEC_TIME_DB_TASK=3600 HARD_MAX_EXEC_TIME_DB_TASK=7200 @@ -95,10 +95,10 @@ COMPRESSION_REMOTE=yes DIRECTORIES_SIMPLE_LIST="/var/named;/var/lib" ## There's a special backup schema in Obackup called 'backup task division' which creates one backup task per level 1 subdirectory of a directory. -## This is VERY usefull to backup multiple virtualhosts as separate tasks without having to specifiy each one separately. -## This may also be usefull dividing big data directories in subdirectories tasks. +## This is VERY useful to backup multiple virtualhosts as separate tasks without having to specify each one separately. +## This may also be useful dividing big data directories in subdirectories tasks. -## Directories backup task division backup: Semicolon separated directories of which every level 1 subdirectory will be backed up recursively as a spearate backup task. +## Directories backup task division backup: Semicolon separated directories of which every level 1 subdirectory will be backed up recursively as a separate backup task. ## Example: "/home;/var" will create tasks "/home/dir1", "/home/dir2", ... "/home/dirN", "/var/log", "/var/lib"... "/var/whatever" DIRECTORIES_RECURSE_LIST="/home" ## You may optionally exclude subdirectories from task division. On the above example you could exclude /home/dir2 by adding it to DIRECTORIES_RECURSE_EXCLUDE_LIST @@ -113,7 +113,7 @@ RSYNC_EXCLUDE_PATTERN="*/tmp;*/ftp/www/cache/cachefs;*/sessions" RSYNC_EXCLUDE_FROM="" #RSYNC_EXCLUDE_FROM="exclude.list" -## List separator char. You may set an alternative seperator char for your directories lists above. +## List separator char. You may set an alternative separator char for your directories lists above. PATH_SEPARATOR_CHAR=";" ## Preserve ACLS. Make sure source and target FS can hold same ACLs or you'll get loads of errors. @@ -129,14 +129,14 @@ KEEP_DIRLINKS=yes PRESERVE_HARDLINKS=no -## Let RSYNC compress file transfers. Do not use this on local-local backup schemes. Also, this is not usefull if SSH compression is enabled. +## Let RSYNC compress file transfers. Do not use this on local-local backup schemes. Also, this is not useful if SSH compression is enabled. RSYNC_COMPRESS=no ## Max execution time per file backup task. Soft is warning only. Hard is warning, stopping backup and processing next one one file list. Tilme is specified in seconds SOFT_MAX_EXEC_TIME_FILE_TASK=3600 HARD_MAX_EXEC_TIME_FILE_TASK=7200 -## Keep partial uploads that can be resumed on next run, experimantal feature +## Keep partial uploads that can be resumed on next run, experimental 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. @@ -144,7 +144,7 @@ DELETE_VANISHED_FILES=no ## ---------- ALERT OPTIONS -## Alert email adresses separated by a space character +## Alert email addresses separated by a space character DESTINATION_MAILS="your@mail.address" ## Windows (MSYS environment) only mail options (used by sendemail.exe) @@ -167,14 +167,14 @@ ROTATE_COPIES=7 ## ---------- EXECUTION HOOKS ## Commands can will be run before and / or after backup execution (remote execution will only happen if REMOTE_BACKUP is set). -## This is usefull to make a snapshot before backing up data, or even handle snapshots of backed up data. +## This is useful to make a snapshot before backing up data, or even handle snapshots of backed up data. LOCAL_RUN_BEFORE_CMD="" LOCAL_RUN_AFTER_CMD="" REMOTE_RUN_BEFORE_CMD="" REMOTE_RUN_AFTER_CMD="" -## Max execution time of commands before they get force killed. Leave 0 if you don't wan't this to happen. Time is specified in seconds. +## Max execution time of commands before they get force killed. Leave 0 if you don't want this to happen. Time is specified in seconds. MAX_EXEC_TIME_PER_CMD_BEFORE=0 MAX_EXEC_TIME_PER_CMD_AFTER=0 diff --git a/obackup.sh b/obackup.sh index bf76a5a..4d4e5f4 100755 --- a/obackup.sh +++ b/obackup.sh @@ -5,7 +5,7 @@ AUTHOR="(L) 2013-2015 by Orsiris \"Ozy\" de Jong" CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr" PROGRAM_VERSION=1.84RC4 -PROGRAM_BUILD=0801201504 +PROGRAM_BUILD=1202201501 ## 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 @@ -966,6 +966,8 @@ function GetDirectoriesSize function RsyncExcludePattern { + # Disable globbing so wildcards from exclusions don't get expanded + set -f OLD_IFS=$IFS IFS=$PATH_SEPARATOR_CHAR for excludedir in $RSYNC_EXCLUDE_PATTERN @@ -978,6 +980,7 @@ function RsyncExcludePattern fi done IFS=$OLD_IFS + set +f } function RsyncExcludeFrom