diff --git a/ccollect.sh b/ccollect.sh index 7c41352..59a0b02 100755 --- a/ccollect.sh +++ b/ccollect.sh @@ -285,7 +285,7 @@ while [ "${i}" -lt "${no_sources}" ]; do c_pre_exec="${backup}/pre_exec" c_post_exec="${backup}/post_exec" for opt in exclude verbose very_verbose rsync_options summary delete_incomplete \ - remote_host rsync_failure_codes mtime ; do + remote_host rsync_failure_codes mtime quiet_if_down ; do if [ -f "${backup}/$opt" -o -f "${backup}/no_$opt" ]; then eval c_$opt=\"${backup}/$opt\" else @@ -368,7 +368,14 @@ while [ "${i}" -lt "${no_sources}" ]; do # # Verify source is up and accepting connections before deleting any old backups # - rsync "${source}" >/dev/null || _exit_err "Source ${source} is not readable. Skipping." + if ! rsync "${source}" >/dev/null 2>"${TMP}" ; then + if [ -f "${c_quiet_if_down}" ]; then + _exit_err "Source ${source} is not readable. Skipping." + else + cat "${TMP}" + _exit_err "Error: source ${source} is not readable. Skipping." + fi + fi # # Destination is a path diff --git a/doc/ccollect.text b/doc/ccollect.text index 9781387..9a76837 100644 --- a/doc/ccollect.text +++ b/doc/ccollect.text @@ -361,6 +361,7 @@ Additionally a source may have the following files: - `remote_host` host to backup to - `rsync_failure_codes` list of rsync exit codes that indicate complete failure - `mtime` Sort backup directories based on their modification time + - `quiet_if_down` Suppress error messages if source is not connectable Example: @@ -585,8 +586,8 @@ be left in the destination directory indicating failure of this backup. If you have enabled delete_incomplete, then this backup will be deleted during the next ccollect run on the same interval. -mtime -^^^^^ +Detailed description of "mtime" +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ By default, ccollect.sh chooses the most recent backup directory for cloning or the oldest for deletion based on the directory's last change time (ctime). With this option, the sorting is done based on modification time (mtime). With @@ -596,7 +597,15 @@ your backups to another hard disk using cp -a or rsync -a, you should use this option because the ctimes are not preserved during such operations. If you have any backups in your repository made with ccollect version 0.7.1 or -earlier, do not use this option and do not move your repository. +earlier, do not use this option. + +Detailed description of "quiet_if_down" +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +By default, ccollect.sh emits a series of error messages if a source is not +connectable. With this option enabled, ccollect.sh still reports that the +source is not connectable but the associated error messages generated by +rsync or ssh are suppressed. You may want to use this option for sources, +like notebook PCs, that are often disconnected. Hints -----