From 3268ff08586a0e7ad3e0f56bb0d4e9a0b4540e6b Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Thu, 28 Dec 2023 15:23:52 +0100 Subject: [PATCH] Add note for includes/excludes brace expansion --- client/lib/main.sh | 42 ++++++++++++++++++++++++------------------ client/zzz_evobackup | 6 +++++- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/client/lib/main.sh b/client/lib/main.sh index bcb2218..6027505 100644 --- a/client/lib/main.sh +++ b/client/lib/main.sh @@ -44,6 +44,8 @@ sync_tasks_wrapper() { case "${SYSTEM}" in linux) + # NOTE: remember to single-quote paths if they contain globs (*) + # and you want to defer expansion declare -a rsync_default_includes=( /bin /boot @@ -54,6 +56,8 @@ sync_tasks_wrapper() { ) ;; *bsd) + # NOTE: remember to single-quote paths if they contain globs (*) + # and you want to defer expansion declare -a rsync_default_includes=( /bin /bsd @@ -71,6 +75,8 @@ sync_tasks_wrapper() { fi readonly rsync_default_includes + # NOTE: remember to single-quote paths if they contain globs (*) + # and you want to defer expansion declare -a rsync_default_excludes=( /dev /proc @@ -83,15 +89,15 @@ sync_tasks_wrapper() { /usr/src /var/apt /var/cache - /var/db/munin/*.tmp + '/var/db/munin/*.tmp' /var/lib/amavis/amavisd.sock /var/lib/amavis/tmp /var/lib/amavis/virusmails - /var/lib/clamav/*.tmp + '/var/lib/clamav/*.tmp' /var/lib/elasticsearch /var/lib/metche /var/lib/mongodb - /var/lib/munin/*tmp* + '/var/lib/munin/*tmp*' /var/lib/mysql /var/lib/php/sessions /var/lib/php5 @@ -106,20 +112,20 @@ sync_tasks_wrapper() { /var/state /var/tmp lost+found - .nfs.* - lxc/*/rootfs/tmp - lxc/*/rootfs/usr/doc - lxc/*/rootfs/usr/obj - lxc/*/rootfs/usr/share/doc - lxc/*/rootfs/usr/src - lxc/*/rootfs/var/apt - lxc/*/rootfs/var/cache - lxc/*/rootfs/var/lib/php5 - lxc/*/rootfs/var/lib/php/sessions - lxc/*/rootfs/var/lock - lxc/*/rootfs/var/run - lxc/*/rootfs/var/state - lxc/*/rootfs/var/tmp + '.nfs.*' + 'lxc/*/rootfs/tmp' + 'lxc/*/rootfs/usr/doc' + 'lxc/*/rootfs/usr/obj' + 'lxc/*/rootfs/usr/share/doc' + 'lxc/*/rootfs/usr/src' + 'lxc/*/rootfs/var/apt' + 'lxc/*/rootfs/var/cache' + 'lxc/*/rootfs/var/lib/php5' + 'lxc/*/rootfs/var/lib/php/sessions' + 'lxc/*/rootfs/var/lock' + 'lxc/*/rootfs/var/run' + 'lxc/*/rootfs/var/state' + 'lxc/*/rootfs/var/tmp' /home/mysqltmp ) readonly rsync_default_excludes @@ -443,4 +449,4 @@ main() { send_mail exit ${GLOBAL_RC} -} \ No newline at end of file +} diff --git a/client/zzz_evobackup b/client/zzz_evobackup index 85e610f..ae0e4ef 100644 --- a/client/zzz_evobackup +++ b/client/zzz_evobackup @@ -94,6 +94,8 @@ sync_tasks() { # What to include in your sync task # Add or remove paths if you need + # NOTE: remember to single-quote paths if they contain globs (*) + # and you want to defer expansion # shellcheck disable=SC2034 RSYNC_INCLUDES=( "${rsync_default_includes[@]}" @@ -106,6 +108,8 @@ sync_tasks() { # What to exclude from your sync task # Add or remove paths if you need + # NOTE: remember to single-quote paths if they contain globs (*) + # and you want to defer expansion # shellcheck disable=SC2034 RSYNC_EXCLUDES=( "${rsync_default_excludes[@]}" @@ -273,4 +277,4 @@ source "${LIBDIR}/main.sh" ########## Let's go! ################################################## -main \ No newline at end of file +main