diff --git a/proxmox/backup.pve.content.sh b/proxmox/backup.pve.content.sh index 7a73806..337539e 100755 --- a/proxmox/backup.pve.content.sh +++ b/proxmox/backup.pve.content.sh @@ -13,6 +13,7 @@ readonly NBARGS="${#}" [ -z "${DEBUG}" ] && DEBUG=1 readonly DEFAULT_LOCAL_BKP_DIR="/etc/proxmox.pve/backup" +readonly TODAY_VAR=$(date +%Y%m%d) ## Colors readonly PURPLE='\033[1;35m' @@ -96,12 +97,24 @@ main() { # {{{ ## Define all vars define_vars - ## Verify if the destination directory is absent {{{ + ## Verify if the local destination directory is absent {{{ ### AND create it is_directory_absent "${local_bkp_dir}" \ && mkdir -p -- ${local_bkp_dir} ## }}} + ## Create an archive of /etc/pve to $local_bkp_dir {{{ + ### OR exit with error code 2 if it fails + tar czf "${local_bkp_dir}/pve.${TODAY_VAR}.tar.gz" -C /etc/ pve/ \ + || exit 2 + ## }}} + ## Create an hard link to pve.latest.tar.gz {{{ + ### OR exit with error code 3 if it fails + ln -- "${local_bkp_dir}/pve.${TODAY_VAR}.tar.gz" "${local_bkp_dir}/pve.latest.tar.gz" \ + || exit 3 + ## }}} + + } # }}}