From 3ad60f6f39488b3a126e2eae9aa7f2decefd33d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Fri, 18 Oct 2019 19:26:42 +0200 Subject: [PATCH] WIP: Add debug messages --- docker/container.backup | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docker/container.backup b/docker/container.backup index 363e671..6b30c82 100755 --- a/docker/container.backup +++ b/docker/container.backup @@ -88,13 +88,18 @@ fi # }}} # Stop the container service {{{ systemctl stop "${ct_service_name}" +[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Service management — Service ${ct_service_name} was stopped." # }}} # Backup container data {{{ ## Create the directory to store archive if doesn't already exist -[ -d "${ct_backup_path}" ] || mkdir -p -- "${ct_backup_path}" +if [ ! -d "${ct_backup_path}" ]; then + mkdir -p -- "${ct_backup_path}" + [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Backup data — ${ct_backup_path} was created." +fi ## Backup container data tar czf "${ct_backup_path}/${ct_name}-backup.$(date '+%Y%m%d-%H%M').tar.gz" --directory "${docker_data_path}" "${ct_name}" +[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Backup data — Data of ${ct_name} container were successfully backuped ${ct_backup_path}/${ct_name}-backup.$(date '+%Y%m%d-%H%M').tar.gz" # }}} exit 0