diff --git a/docker/container.backup b/docker/container.backup index 4f9be9a..8ec63cd 100755 --- a/docker/container.backup +++ b/docker/container.backup @@ -3,7 +3,7 @@ # Purpose {{{ ## Backup data of a Docker container. ## To do that, the script will : -## Stop the corresponding container (or docker if no related service is found) +## Try to stop the corresponding container (or docker if no related service is found) ## Make a archive of the container's data to a backup path ## Clean old backup ## Restart the container service (or docker.service) @@ -60,6 +60,24 @@ esac [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Args management — Path to store the backup : ${docker_backup_path} ." # }}} +## Ensure Docker data directory exists {{{ +if [ ! -d "${docker_data_path}" ]; then + printf '\e[0;31m%-6s\e[m\n' "Docker data directory doesn't seems available : ${docker_data_path} ." + exit 1 +fi +## }}} +## Ensure backup directory exists {{{ +if [ ! -d "${docker_backup_path}" ]; then + printf '\e[0;31m%-6s\e[m\n' "Backup directory doesn't seems available : ${docker_backup_path} ." + exit 1 +fi +## }}} +## Ensure container data directory exists {{{ +if [ ! -d "${docker_data_path}/${ct_name}" ]; then + printf '\e[0;31m%-6s\e[m\n' "Container directory doesn't seems available : ${docker_data_path}/${ct_name} ." + exit 1 +fi +## }}} # }}}