From 91089b9452594ce0506bd900edcf059005941da9 Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Mon, 2 Dec 2019 09:26:47 +0100 Subject: [PATCH 01/15] gitlab runner should have necessary tools --- .gitlab-ci.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b499ddc..5391f4d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,18 +3,10 @@ stages: unit_tests: stage: test - before_script: - - 'apk update' - - 'apk add make rsync' script: - make test shellcheck: stage: test - before_script: - - 'apk update' - - 'apk add make' - - 'wget https://storage.googleapis.com/shellcheck/shellcheck-stable.linux.x86_64.tar.xz' - - 'tar xf shellcheck-stable.linux.x86_64.tar.xz && mv shellcheck-stable/shellcheck /usr/bin/' script: - make shellcheck From 109b70ea769755fbb576e3ee83af399fb5735e9e Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Mon, 2 Dec 2019 09:26:47 +0100 Subject: [PATCH 02/15] gitlab runner should have necessary tools --- .gitlab-ci.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b499ddc..5391f4d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,18 +3,10 @@ stages: unit_tests: stage: test - before_script: - - 'apk update' - - 'apk add make rsync' script: - make test shellcheck: stage: test - before_script: - - 'apk update' - - 'apk add make' - - 'wget https://storage.googleapis.com/shellcheck/shellcheck-stable.linux.x86_64.tar.xz' - - 'tar xf shellcheck-stable.linux.x86_64.tar.xz && mv shellcheck-stable/shellcheck /usr/bin/' script: - make shellcheck From a261ef841eb76595d169eef334b8f004a2d3737c Mon Sep 17 00:00:00 2001 From: Steffen Zieger Date: Sun, 24 May 2020 16:40:04 +0200 Subject: [PATCH 03/15] make rsync return code available in post_exec --- ccollect | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ccollect b/ccollect index 39799cd..679e3ca 100755 --- a/ccollect +++ b/ccollect @@ -824,6 +824,11 @@ while [ "${source_no}" -lt "${no_sources}" ]; do rsync "$@" "${source}" "${destination_dir}"; ret=$? _techo "Finished backup (rsync return code: $ret)." + # + # export rsync return code, might be useful in post_exec + # + export rsync_return_code=$ret + # # Set modification time (mtime) to current time, if sorting by mtime is enabled # From 28dec3694ae11b3924ba76c7de830183857d08bd Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Sun, 24 May 2020 17:29:29 +0200 Subject: [PATCH 04/15] ++changelog --- doc/changes/next | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changes/next diff --git a/doc/changes/next b/doc/changes/next new file mode 100644 index 0000000..45097c7 --- /dev/null +++ b/doc/changes/next @@ -0,0 +1 @@ +* Make rsync return code available in post_exec (Steffen Zieger) From 7a7dec7751862ca1eec30f2041c80e40746766b3 Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Mon, 25 May 2020 12:05:35 +0200 Subject: [PATCH 05/15] Release 2.9 --- ccollect | 4 ++-- doc/ccollect.text | 2 +- doc/changes/{next => 2.9} | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename doc/changes/{next => 2.9} (100%) diff --git a/ccollect b/ccollect index 679e3ca..01c5d05 100755 --- a/ccollect +++ b/ccollect @@ -45,8 +45,8 @@ TMP="$(mktemp "/tmp/${__myname}.XXXXXX")" export TMP CONTROL_PIPE="/tmp/${__myname}-control-pipe" -VERSION="2.8" -RELEASE="2019-11-26" +VERSION="2.9" +RELEASE="2020-05-25" HALF_VERSION="ccollect ${VERSION}" FULL_VERSION="ccollect ${VERSION} (${RELEASE})" diff --git a/doc/ccollect.text b/doc/ccollect.text index 84c326e..bc8326a 100644 --- a/doc/ccollect.text +++ b/doc/ccollect.text @@ -1,7 +1,7 @@ ccollect - Installing, Configuring and Using ============================================ Nico Schottelius -2.8, for ccollect 2.8, Initial Version from 2006-01-13 +2.9, for ccollect 2.9, Initial Version from 2006-01-13 :Author Initials: NS diff --git a/doc/changes/next b/doc/changes/2.9 similarity index 100% rename from doc/changes/next rename to doc/changes/2.9 From 616b1d9e3e9cf996e1f90bfc8ede58143ed0e7e7 Mon Sep 17 00:00:00 2001 From: Steffen Zieger Date: Mon, 25 May 2020 16:16:32 +0200 Subject: [PATCH 06/15] Add 'current' symlink to backup destinations --- ccollect | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ccollect b/ccollect index 01c5d05..b4af2f1 100755 --- a/ccollect +++ b/ccollect @@ -861,6 +861,16 @@ while [ "${source_no}" -lt "${no_sources}" ]; do _techo "Warning: rsync failed with return code $ret." fi + # + # Create symlink to newest backup + # + # shellcheck disable=SC2010 + latest_dir="$(ls -${TSORT}p1 "${ddir}" | grep '/$' | head -n 1)" || \ + _exit_err "Failed to list content of ${ddir}." + + ln -snf "${ddir}${latest_dir}" "${ddir}current" || \ + _exit_err "Failed to create 'current' symlink." + # # post_exec # From 309d8dc773182a053619a93bc099f88f087b4c0e Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Mon, 25 May 2020 17:52:23 +0200 Subject: [PATCH 07/15] ++changelog --- doc/changes/next | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changes/next diff --git a/doc/changes/next b/doc/changes/next new file mode 100644 index 0000000..1d1e85d --- /dev/null +++ b/doc/changes/next @@ -0,0 +1 @@ +* Add 'current' symlink to backup destinations (Steffen Zieger) From 08cb857664a6dbcbacaffc020c747db554ebbf15 Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Wed, 26 Aug 2020 08:36:43 +0200 Subject: [PATCH 08/15] Release 2.10 --- ccollect | 4 ++-- doc/ccollect.text | 2 +- doc/changes/{next => 2.10} | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename doc/changes/{next => 2.10} (100%) diff --git a/ccollect b/ccollect index b4af2f1..2deaa2d 100755 --- a/ccollect +++ b/ccollect @@ -45,8 +45,8 @@ TMP="$(mktemp "/tmp/${__myname}.XXXXXX")" export TMP CONTROL_PIPE="/tmp/${__myname}-control-pipe" -VERSION="2.9" -RELEASE="2020-05-25" +VERSION="2.10" +RELEASE="2020-08-26" HALF_VERSION="ccollect ${VERSION}" FULL_VERSION="ccollect ${VERSION} (${RELEASE})" diff --git a/doc/ccollect.text b/doc/ccollect.text index bc8326a..f075b9a 100644 --- a/doc/ccollect.text +++ b/doc/ccollect.text @@ -1,7 +1,7 @@ ccollect - Installing, Configuring and Using ============================================ Nico Schottelius -2.9, for ccollect 2.9, Initial Version from 2006-01-13 +2.10, for ccollect 2.10, Initial Version from 2006-01-13 :Author Initials: NS diff --git a/doc/changes/next b/doc/changes/2.10 similarity index 100% rename from doc/changes/next rename to doc/changes/2.10 From 2ca7598593befc52bff6b51b330bbcf508e20387 Mon Sep 17 00:00:00 2001 From: Jun Futagawa Date: Wed, 25 Nov 2020 11:24:37 +0900 Subject: [PATCH 09/15] Improve 'current' symlink to backup destinations --- ccollect | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccollect b/ccollect index 2deaa2d..8b8f9e5 100755 --- a/ccollect +++ b/ccollect @@ -868,7 +868,7 @@ while [ "${source_no}" -lt "${no_sources}" ]; do latest_dir="$(ls -${TSORT}p1 "${ddir}" | grep '/$' | head -n 1)" || \ _exit_err "Failed to list content of ${ddir}." - ln -snf "${ddir}${latest_dir}" "${ddir}current" || \ + ln -snf "${ddir}/${latest_dir}" "${ddir}/current" || \ _exit_err "Failed to create 'current' symlink." # From 7d298d2b51f30f95407e2bdfc8e4e04fb14f66e2 Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Wed, 25 Nov 2020 16:17:29 +0100 Subject: [PATCH 10/15] ++changelog --- doc/changes/next | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changes/next diff --git a/doc/changes/next b/doc/changes/next new file mode 100644 index 0000000..81efe7b --- /dev/null +++ b/doc/changes/next @@ -0,0 +1 @@ +* Fix 'current' symlink (Jun Futagawa) From 40dbfbd3a38b2064b095bea621600be1637dbd2d Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Wed, 25 Nov 2020 16:20:28 +0100 Subject: [PATCH 11/15] Fix test: also count 'current' symlink --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 789e099..cda6d81 100644 --- a/Makefile +++ b/Makefile @@ -235,13 +235,13 @@ test-interval-changing: $(CCOLLECT_SOURCE) test-dir-source test-dir-destination- test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "0" || { cat ${TEST_LOG_FILE}; exit 1; } printf "3" > ./test/conf/sources/local-with-interval/intervals/daily for x in 1 2 3 4 5; do CCOLLECT_CONF=./test/conf ./ccollect -l ${TEST_LOG_FILE} daily local-with-interval; done - test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "3" || { cat ${TEST_LOG_FILE}; exit 1; } + test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "4" || { cat ${TEST_LOG_FILE}; exit 1; } printf "5" > ./test/conf/sources/local-with-interval/intervals/daily for x in 1 2 3 4 5 6 7; do CCOLLECT_CONF=./test/conf ./ccollect -l ${TEST_LOG_FILE} daily local-with-interval; done - test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "5" || { cat ${TEST_LOG_FILE}; exit 1; } + test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "6" || { cat ${TEST_LOG_FILE}; exit 1; } printf "4" > ./test/conf/sources/local-with-interval/intervals/daily for x in 1 2 3 4 5 6; do CCOLLECT_CONF=./test/conf ./ccollect -l ${TEST_LOG_FILE} daily local-with-interval; done - test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "4" || { cat ${TEST_LOG_FILE}; exit 1; } + test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "5" || { cat ${TEST_LOG_FILE}; exit 1; } printf "3" > ./test/conf/sources/local-with-interval/intervals/daily @printf "\nInterval changing test ended successfully\n" From b50b3f64dc86182f93c348b4ff9d286d70bc7d28 Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Wed, 25 Nov 2020 16:21:44 +0100 Subject: [PATCH 12/15] Update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e5c18f6..6a82cbe 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ doc/*.xml doc/*/*.xml *.texi *.fo +*.lock From cdd34a3416cd5c70c0334329eb6c0204f7c643bd Mon Sep 17 00:00:00 2001 From: skybeam Date: Sat, 14 Jan 2023 21:57:24 +0000 Subject: [PATCH 13/15] Allow interval per source to be overwritten to 0 to skip the source in this interval. This change allows to overwrite an interval to 0 for a specific source in order to skip it for this interval. This is useful if you have default intervals configured and you would like to skip certain sources for specific intervals. --- ccollect | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ccollect b/ccollect index 8b8f9e5..5aaefe2 100755 --- a/ccollect +++ b/ccollect @@ -765,7 +765,7 @@ while [ "${source_no}" -lt "${no_sources}" ]; do oldest_bak=$(ls -${TSORT}1r | grep "^${INTERVAL}\\." | head -n 1 || \ _exit_err "Listing oldest backup failed") _techo "Using ${oldest_bak} for destination dir ${destination_dir}" - if mv "${oldest_bak}" "${destination_dir}"; then + if mv "${oldest_bak}" "${destination_dir}" 2>/dev/null; then # Touch dest dir so it is not sorted wrong in listings below. ls_rm_exclude=$(basename "${destination_dir}") @@ -779,7 +779,7 @@ while [ "${source_no}" -lt "${no_sources}" ]; do if [ "${remove}" -gt 0 ]; then _techo "Removing ${remove} backup(s)..." - if [ -z "${ls_rm_exclude}" ]; then + if [ -z "${ls_rm_exclude}" -o ${c_interval} -le 0 ]; then # shellcheck disable=SC2010 ls -${TSORT}1r | grep "^${INTERVAL}\\." | head -n "${remove}" > "${TMP}" || \ _exit_err "Listing old backups failed" @@ -793,6 +793,14 @@ while [ "${source_no}" -lt "${no_sources}" ]; do fi fi + # + # Skip backup of this source if interval is zero. + # + if [ ${c_interval} -le 0 ]; then + _techo "Skipping backup for this interval." + exit 0 + fi + # # Check for backup directory to clone from: Always clone from the latest one! # Exclude destination_dir from listing, it can be touched reused and renamed From ebded3049a9081769f05e67a5f6802adf906e6ac Mon Sep 17 00:00:00 2001 From: skybeam Date: Sun, 15 Jan 2023 22:31:02 +0000 Subject: [PATCH 14/15] Update 'ccollect' --- ccollect | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ccollect b/ccollect index 5aaefe2..86acec5 100755 --- a/ccollect +++ b/ccollect @@ -779,7 +779,7 @@ while [ "${source_no}" -lt "${no_sources}" ]; do if [ "${remove}" -gt 0 ]; then _techo "Removing ${remove} backup(s)..." - if [ -z "${ls_rm_exclude}" -o ${c_interval} -le 0 ]; then + if [ -z "${ls_rm_exclude}" -o ${c_interval} -eq 0 ]; then # shellcheck disable=SC2010 ls -${TSORT}1r | grep "^${INTERVAL}\\." | head -n "${remove}" > "${TMP}" || \ _exit_err "Listing old backups failed" @@ -796,7 +796,7 @@ while [ "${source_no}" -lt "${no_sources}" ]; do # # Skip backup of this source if interval is zero. # - if [ ${c_interval} -le 0 ]; then + if [ ${c_interval} -eq 0 ]; then _techo "Skipping backup for this interval." exit 0 fi From 1cc921ad8630cf9d7bbefd2281e6853c1454d501 Mon Sep 17 00:00:00 2001 From: skybeam Date: Sun, 15 Jan 2023 23:32:27 +0000 Subject: [PATCH 15/15] Interval value of 0 to skip interval for speicific sources. Update documentation to specify that intervals with value 0 are valid to skip an interval explicitly for a given source. --- doc/ccollect.text | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/ccollect.text b/doc/ccollect.text index f075b9a..6aee365 100644 --- a/doc/ccollect.text +++ b/doc/ccollect.text @@ -339,6 +339,9 @@ Example: -------------------------------------------------------------------------------- This means to keep 28 daily backups, 12 monthly backups and 4 weekly. +If you set a value of 0 the interval will be skipped. This is useful mainly on +source level in order to skip a certain interval for a specific source. + General pre- and post-execution ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -420,6 +423,12 @@ Example: /home/nico/vpn -------------------------------------------------------------------------------- +You can overwrite a default interval at source level. Setting it to 0 will skip +this interval on a specific source allowing you to skip an interval for a +specific source only while keeping source-specific interval amounts (or default +values) for any other source. + + Default options ^^^^^^^^^^^^^^^ If you add '$CCOLLECT_CONF/defaults/`option_name`', the value will