@@ -411,11 +411,11 @@ restic_create_schedulers() {
411411 local instance="${1}"
412412 instance=$(printf "%02d" ${instance})
413413 if [ -v BACKUP${instance}_REPOSITORY_PATH ] && [ "$(set -o posix; set | grep -E "^BACKUP${instance}_REPOSITORY_PATH" | cut -d = -f 2)" != "unset" ]; then
414- echo "BACKUP${instance} $(grep -E "^BACKUP${instance}_REPOSITORY_PATH" | cut -d = -f 2)" >> /container/state/restic/INIT_REPOSITORIES
414+ echo "BACKUP${instance} $(grep -E "^BACKUP${instance}_REPOSITORY_PATH" | cut -d = -f 2)" | silent tee -a /container/state/restic/INIT_REPOSITORIES
415415 elif [ -n "${DEFAULT_BACKUP_REPOSITORY_PATH}" ] && [ "${DEFAULT_BACKUP_REPOSITORY_PATH}" != "unset" ]; then
416- echo "BACKUP${instance} ${DEFAULT_BACKUP_REPOSITORY_PATH}" >> /container/state/restic/INIT_REPOSITORIES
416+ echo "BACKUP${instance} ${DEFAULT_BACKUP_REPOSITORY_PATH}" | silent tee -a /container/state/restic/INIT_REPOSITORIES
417417 elif [ -n "${REPOSITORY_PATH}" ] && [ "${REPOSITORY_PATH}" != "unset" ]; then
418- echo "BACKUP${instance} ${REPOSITORY_PATH}" >> /container/state/restic/INIT_REPOSITORIES
418+ echo "BACKUP${instance} ${REPOSITORY_PATH}" | silent tee -a /container/state/restic/INIT_REPOSITORIES
419419 fi
420420 cp -R /container/data/restic/template-restic-backup /container/run/available/restic-backup"${instance}"
421421 sed -i "s|{{BACKUP_NUMBER}}|${instance}|g" /container/run/available/restic-backup"${instance}"/run
@@ -451,11 +451,11 @@ EOF
451451 local instance="${1}"
452452 instance=$(printf "%02d" $instance)
453453 if [ -v CHECK${instance}_REPOSITORY_PATH ] && [ "$(set -o posix; set | grep -E "^CHECK${instance}_REPOSITORY_PATH" | cut -d = -f 2)" != "unset" ]; then
454- echo "CHECK${instance} $(set -o posix; set | grep -E "^CHECK${instance}_REPOSITORY_PATH" | cut -d = -f 2)" >> /container/state/restic/INIT_REPOSITORIES
454+ echo "CHECK${instance} $(set -o posix; set | grep -E "^CHECK${instance}_REPOSITORY_PATH" | cut -d = -f 2)" | silent tee -a /container/state/restic/INIT_REPOSITORIES
455455 elif [ -n "${DEFAULT_CHECK_REPOSITORY_PATH}" ] && [ "${DEFAULT_CHECK_REPOSITORY_PATH}" != "unset" ]; then
456- echo "CHECK${instance} ${DEFAULT_CHECK_REPOSITORY_PATH}" >> /container/state/restic/INIT_REPOSITORIES
456+ echo "CHECK${instance} ${DEFAULT_CHECK_REPOSITORY_PATH}" | silent tee -a /container/state/restic/INIT_REPOSITORIES
457457 elif [ -n "${REPOSITORY_PATH}" ] && [ "${REPOSITORY_PATH}" != "unset" ]; then
458- echo "CHECK${instance} ${REPOSITORY_PATH}" >> /container/state/restic/INIT_REPOSITORIES
458+ echo "CHECK${instance} ${REPOSITORY_PATH}" | silent tee -a /container/state/restic/INIT_REPOSITORIES
459459 fi
460460 cp -R /container/data/restic/template-restic-check /container/run/available/restic-check"${instance}"
461461 sed -i "s|{{CHECK_NUMBER}}|${instance}|g" /container/run/available/restic-check"${instance}"/run
@@ -491,11 +491,11 @@ EOF
491491 local instance="${1}"
492492 instance=$(printf "%02d" $instance)
493493 if [ -v CLEANUP${instance}_REPOSITORY_PATH ] && [ "$(set -o posix; set | grep -E "^CLEANUP${instance}_REPOSITORY_PATH" | cut -d = -f 2)" != "unset" ]; then
494- echo "CLEANUP${instance} $(set -o posix; set | grep -E "^CLEANUP${instance}_REPOSITORY_PATH" | cut -d = -f 2)" >> /container/state/restic/INIT_REPOSITORIES
494+ echo "CLEANUP${instance} $(set -o posix; set | grep -E "^CLEANUP${instance}_REPOSITORY_PATH" | cut -d = -f 2)" | silent tee -a /container/state/restic/INIT_REPOSITORIES
495495 elif [ -n "${DEFAULT_CLEANUP_REPOSITORY_PATH}" ] && [ "${DEFAULT_CLEANUP_REPOSITORY_PATH}" != "unset" ]; then
496- echo "CLEANUP${instance} ${DEFAULT_CLEANUP_REPOSITORY_PATH}" >> /container/state/restic/INIT_REPOSITORIES
496+ echo "CLEANUP${instance} ${DEFAULT_CLEANUP_REPOSITORY_PATH}" | silent tee -a /container/state/restic/INIT_REPOSITORIES
497497 elif [ -n "${REPOSITORY_PATH}" ] && [ "${REPOSITORY_PATH}" != "unset" ]; then
498- echo "CLEANUP${instance} ${REPOSITORY_PATH}" >> /container/state/restic/INIT_REPOSITORIES
498+ echo "CLEANUP${instance} ${REPOSITORY_PATH}" | silent tee -a /container/state/restic/INIT_REPOSITORIES
499499 fi
500500 cp -R /container/data/restic/template-restic-cleanup /container/run/available/restic-cleanup"${instance}"
501501 sed -i "s|{{CLEANUP_NUMBER}}|${instance}|g" /container/run/available/restic-cleanup"${instance}"/run
@@ -540,11 +540,11 @@ EOF
540540 local instance="${1}"
541541 instance=$(printf "%02d" $instance)
542542 if [ -v INVENTORY${instance}_REPOSITORY_PATH ] && [ "$(set -o posix; set | grep -E "^INVENTORY${instance}_REPOSITORY_PATH" | cut -d = -f 2)" != "unset" ]; then
543- echo "INVENTORY${instance} $(set -o posix; set | grep -E "^INVENTORY${instance}_REPOSITORY_PATH" | cut -d = -f 2)" >> /container/state/restic/INIT_REPOSITORIES
543+ echo "INVENTORY${instance} $(set -o posix; set | grep -E "^INVENTORY${instance}_REPOSITORY_PATH" | cut -d = -f 2)" | silent tee -a /container/state/restic/INIT_REPOSITORIES
544544 elif [ -n "${DEFAULT_INVENTORY_REPOSITORY_PATH}" ] && [ "${DEFAULT_INVENTORY_REPOSITORY_PATH}" != "unset" ]; then
545- echo "INVENTORY${instance} ${DEFAULT_INVENTORY_REPOSITORY_PATH}" >> /container/state/restic/INIT_REPOSITORIES
545+ echo "INVENTORY${instance} ${DEFAULT_INVENTORY_REPOSITORY_PATH}" | silent tee -a /container/state/restic/INIT_REPOSITORIES
546546 elif [ -n "${REPOSITORY_PATH}" ] && [ "${REPOSITORY_PATH}" != "unset" ]; then
547- echo "INVENTORY${instance} ${REPOSITORY_PATH}" >> /container/state/restic/INIT_REPOSITORIES
547+ echo "INVENTORY${instance} ${REPOSITORY_PATH}" | silent tee -a /container/state/restic/INIT_REPOSITORIES
548548 fi
549549 cp -R /container/data/restic/template-restic-inventory /container/run/available/restic-inventory"${instance}"
550550 sed -i "s|{{INVENTORY_NUMBER}}|${instance}|g" /container/run/available/restic-inventory"${instance}"/run
@@ -579,11 +579,11 @@ EOF
579579 local instance="${1}"
580580 instance=$(printf "%02d" $instance)
581581 if [ -v PRUNE${instance}_REPOSITORY_PATH ] && [ "$(set -o posix; set | grep -E "^PRUNE${instance}_REPOSITORY_PATH" | cut -d = -f 2)" != "unset" ]; then
582- echo "PRUNE${instance} $(set -o posix; set | grep -E "^PRUNE${instance}_REPOSITORY_PATH" | cut -d = -f 2)" >> /container/state/restic/INIT_REPOSITORIES
582+ echo "PRUNE${instance} $(set -o posix; set | grep -E "^PRUNE${instance}_REPOSITORY_PATH" | cut -d = -f 2)" | silent tee -a /container/state/restic/INIT_REPOSITORIES
583583 elif [ -n "${DEFAULT_PRUNE_REPOSITORY_PATH}" ] && [ "${DEFAULT_PRUNE_REPOSITORY_PATH}" != "unset" ]; then
584- echo "PRUNE${instance} ${DEFAULT_PRUNE_REPOSITORY_PATH}" >> /container/state/restic/INIT_REPOSITORIES
584+ echo "PRUNE${instance} ${DEFAULT_PRUNE_REPOSITORY_PATH}" | silent tee -a /container/state/restic/INIT_REPOSITORIES
585585 elif [ -n "${REPOSITORY_PATH}" ] && [ "${REPOSITORY_PATH}" != "unset" ]; then
586- echo "PRUNE${instance} ${REPOSITORY_PATH}" >> /container/state/restic/INIT_REPOSITORIES
586+ echo "PRUNE${instance} ${REPOSITORY_PATH}" | silent tee -a /container/state/restic/INIT_REPOSITORIES
587587 fi
588588 cp -R /container/data/restic/template-restic-prune /container/run/available/restic-prune"${instance}"
589589 sed -i "s|{{PRUNE_NUMBER}}|${instance}|g" /container/run/available/restic-prune"${instance}"/run
@@ -777,7 +777,7 @@ restic_notify() {
777777 if [ -z "${SMTP_PORT}" ] ; then print_error "[notifications] No SMTP_PORT variable set - Skipping sending Email notifications" ; skip_mail=true ; fi
778778 if var_nottrue "${skip_mail}" ; then
779779 if ! grep -q ^from /etc/msmptrc ; then
780- echo "from ${MAIL_FROM}" >> /etc/msmtprc
780+ echo "from ${MAIL_FROM}" | silent tee -a /etc/msmtprc
781781 fi
782782 mail_recipients=$(echo "${MAIL_TO}" | tr "," "\n")
783783
@@ -1005,7 +1005,7 @@ restic_repository() {
10051005
10061006 print_info "Starting Backup Snapshot ${backup_job_log_suffix}"
10071007 restic_repository=$(mktemp)
1008- echo "${backup_job_repository_path}" > "${restic_repository}"
1008+ echo "${backup_job_repository_path}" | silent tee "${restic_repository}"
10091009 restic \
10101010 --cache-dir "${CACHE_PATH}" --cleanup-cache \
10111011 --repository-file "${restic_repository}" \
@@ -1261,7 +1261,7 @@ EOF
12611261
12621262 restic_process_limiter restic 1 check
12631263 restic_repository=$(mktemp)
1264- echo "${check_job_repository_path}" > "${restic_repository}"
1264+ echo "${check_job_repository_path}" | silent tee "${restic_repository}"
12651265 restic \
12661266 --cache-dir "${CACHE_PATH}" --cleanup-cache \
12671267 --repository-file "${restic_repository}" \
@@ -1554,7 +1554,7 @@ EOF
15541554
15551555 print_info "Starting cleanup of old backups"
15561556 restic_repository=$(mktemp)
1557- echo "${cleanup_job_repository_path}" > "${restic_repository}"
1557+ echo "${cleanup_job_repository_path}" | silent tee "${restic_repository}"
15581558 restic \
15591559 --cache-dir "${CACHE_PATH}" --cleanup-cache \
15601560 --repository-file "${restic_repository}" \
@@ -1789,7 +1789,7 @@ EOF
17891789 fi
17901790
17911791 restic_repository=$(mktemp)
1792- echo "${repository_to_init}" | awk '{print $2}' > "${restic_repository}"
1792+ echo "${repository_to_init}" | awk '{print $2}' | silent tee "${restic_repository}"
17931793 silent restic \
17941794 --cache-dir "${CACHE_PATH}" --cleanup-cache \
17951795 --repository-file "${restic_repository}" \
@@ -1806,7 +1806,7 @@ EOF
18061806 print_notice "[check_repository] Initializing Repository '$(echo "${repository_to_init}" | awk '{print $1}')'"
18071807
18081808 restic_repository=$(mktemp)
1809- echo "${repository_to_init}" | awk '{print $2}' > "${restic_repository}"
1809+ echo "${repository_to_init}" | awk '{print $2}' | silent tee "${restic_repository}"
18101810
18111811 silent restic \
18121812 --cache-dir "${CACHE_PATH}" --cleanup-cache \
@@ -1819,7 +1819,7 @@ EOF
18191819 print_error "Failed to init the repository: '$(echo "${repository_to_init}" | awk '{print $1}')':"
18201820
18211821 restic_repository=$(mktemp)
1822- echo "${repository_to_init}" | awk '{print $2}' > "${restic_repository}"
1822+ echo "${repository_to_init}" | awk '{print $2}' | silent tee "${restic_repository}"
18231823 restic \
18241824 --cache-dir "${CACHE_PATH}" --cleanup-cache \
18251825 --repository-file "${restic_repository}" \
@@ -1899,7 +1899,7 @@ EOF
18991899 fi
19001900
19011901 restic_repository=$(mktemp)
1902- echo "${inventory_job_repository_path}" > "${restic_repository}"
1902+ echo "${inventory_job_repository_path}" | silent tee "${restic_repository}"
19031903 restic_process_limiter restic 1 inventory
19041904 restic \
19051905 --cache-dir "${CACHE_PATH}" --cleanup-cache \
@@ -2090,7 +2090,7 @@ EOF
20902090
20912091 restic_process_limiter restic 1 prune
20922092 restic_repository=$(mktemp)
2093- echo "${prune_job_repository_path}" > "${restic_repository}"
2093+ echo "${prune_job_repository_path}" | silent tee "${restic_repository}"
20942094 restic \
20952095 --cache-dir "${CACHE_PATH}" --cleanup-cache \
20962096 --repository-file "${restic_repository}" \
@@ -2275,7 +2275,7 @@ EOF
22752275
22762276 if var_true "${DEBUG_MODE}" || [ "${CONTAINER_LOG_LEVEL,,}" = "debug" ]; then
22772277 unlock_command_string="restic --cache-dir ${CACHE_PATH} --repo $(redact_sensitive ${unlock_job_repository_path}) unlock ${unlock_job_args}"
2278- print_debug "Command execution string: '${command_string }'"
2278+ print_debug "Command execution string: '${unlock_command_string }'"
22792279 unlock_job_file_log_lines+=("## Debug Command String: ${unlock_command_string}")
22802280 fi
22812281
@@ -2284,7 +2284,7 @@ EOF
22842284 fi
22852285
22862286 restic_repository=$(mktemp)
2287- echo "${unlock_job_repository_path}" > "${restic_repository}"
2287+ echo "${unlock_job_repository_path}" | silent tee "${restic_repository}"
22882288 restic_process_limiter restic 1 unlock
22892289 restic \
22902290 --cache-dir "${CACHE_PATH}" --cleanup-cache \
@@ -2441,31 +2441,31 @@ restic_setup_container_mode() {
24412441 case "${mode,,}" in
24422442 "backup" )
24432443 print_debug "Enabling Container Mode for: BACKUP"
2444- echo "ENABLE_BACKUP=TRUE" >> /container/state/restic/CONTAINER_MODE
2444+ echo "ENABLE_BACKUP=TRUE" | silent tee -a /container/state/restic/CONTAINER_MODE
24452445 ;;
24462446 "check" )
24472447 print_debug "Enabling Container Mode for: CHECK"
2448- echo "ENABLE_CHECK=TRUE" >> /container/state/restic/CONTAINER_MODE
2448+ echo "ENABLE_CHECK=TRUE" | silent tee -a /container/state/restic/CONTAINER_MODE
24492449 ;;
24502450 "cleanup" )
24512451 print_debug "Enabling Container Mode for: CLEANUP"
2452- echo "ENABLE_CLEANUP=TRUE" >> /container/state/restic/CONTAINER_MODE
2452+ echo "ENABLE_CLEANUP=TRUE" | silent tee -a /container/state/restic/CONTAINER_MODE
24532453 ;;
24542454 "inventory" )
24552455 print_debug "Enabling Container Mode for: INVENTORY"
2456- echo "ENABLE_INVENTORY=TRUE" >> /container/state/restic/CONTAINER_MODE
2456+ echo "ENABLE_INVENTORY=TRUE" | silent tee -a /container/state/restic/CONTAINER_MODE
24572457 ;;
24582458 "prune" )
24592459 print_debug "Enabling Container Mode for: PRUNE"
2460- echo "ENABLE_PRUNE=TRUE" >> /container/state/restic/CONTAINER_MODE
2460+ echo "ENABLE_PRUNE=TRUE" | silent tee -a /container/state/restic/CONTAINER_MODE
24612461 ;;
24622462 "server" )
24632463 print_debug "Enabling Container Mode for: SERVER"
2464- echo "ENABLE_SERVER=TRUE" >> /container/state/restic/CONTAINER_MODE
2464+ echo "ENABLE_SERVER=TRUE" | silent tee -a /container/state/restic/CONTAINER_MODE
24652465 ;;
24662466 "standalone" | "manual" )
24672467 print_debug "Enabling Container Mode for: STANDALONE"
2468- echo "ENABLE_STANDALONE=TRUE" >> /container/state/restic/CONTAINER_MODE
2468+ echo "ENABLE_STANDALONE=TRUE" | silent tee -a /container/state/restic/CONTAINER_MODE
24692469 ;;
24702470 *)
24712471 print_error "Unknown 'MODE' environment variable - exitting.."
0 commit comments