Compare commits

..

1 commit

Author SHA1 Message Date
Darko Poljak
91089b9452 gitlab runner should have necessary tools 2019-12-02 09:27:47 +01:00
7 changed files with 8 additions and 44 deletions

1
.gitignore vendored
View file

@ -14,4 +14,3 @@ doc/*.xml
doc/*/*.xml
*.texi
*.fo
*.lock

View file

@ -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 "4" || { cat ${TEST_LOG_FILE}; exit 1; }
test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "3" || { 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 "6" || { cat ${TEST_LOG_FILE}; exit 1; }
test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "5" || { 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 "5" || { cat ${TEST_LOG_FILE}; exit 1; }
test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "4" || { cat ${TEST_LOG_FILE}; exit 1; }
printf "3" > ./test/conf/sources/local-with-interval/intervals/daily
@printf "\nInterval changing test ended successfully\n"

View file

@ -45,8 +45,8 @@ TMP="$(mktemp "/tmp/${__myname}.XXXXXX")"
export TMP
CONTROL_PIPE="/tmp/${__myname}-control-pipe"
VERSION="2.10"
RELEASE="2020-08-26"
VERSION="2.8"
RELEASE="2019-11-26"
HALF_VERSION="ccollect ${VERSION}"
FULL_VERSION="ccollect ${VERSION} (${RELEASE})"
@ -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}" 2>/dev/null; then
if mv "${oldest_bak}" "${destination_dir}"; 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}" -o ${c_interval} -eq 0 ]; then
if [ -z "${ls_rm_exclude}" ]; then
# shellcheck disable=SC2010
ls -${TSORT}1r | grep "^${INTERVAL}\\." | head -n "${remove}" > "${TMP}" || \
_exit_err "Listing old backups failed"
@ -793,14 +793,6 @@ while [ "${source_no}" -lt "${no_sources}" ]; do
fi
fi
#
# Skip backup of this source if interval is zero.
#
if [ ${c_interval} -eq 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
@ -832,11 +824,6 @@ 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
#
@ -869,16 +856,6 @@ 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
#

View file

@ -1,7 +1,7 @@
ccollect - Installing, Configuring and Using
============================================
Nico Schottelius <nico-ccollect__@__schottelius.org>
2.10, for ccollect 2.10, Initial Version from 2006-01-13
2.8, for ccollect 2.8, Initial Version from 2006-01-13
:Author Initials: NS
@ -339,9 +339,6 @@ 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
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -423,12 +420,6 @@ 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

View file

@ -1 +0,0 @@
* Add 'current' symlink to backup destinations (Steffen Zieger)

View file

@ -1 +0,0 @@
* Make rsync return code available in post_exec (Steffen Zieger)

View file

@ -1 +0,0 @@
* Fix 'current' symlink (Jun Futagawa)