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