Create archive and hard link to latest file
This commit is contained in:
parent
49d0740b7e
commit
b8d3c9554f
|
@ -13,6 +13,7 @@ readonly NBARGS="${#}"
|
||||||
[ -z "${DEBUG}" ] && DEBUG=1
|
[ -z "${DEBUG}" ] && DEBUG=1
|
||||||
|
|
||||||
readonly DEFAULT_LOCAL_BKP_DIR="/etc/proxmox.pve/backup"
|
readonly DEFAULT_LOCAL_BKP_DIR="/etc/proxmox.pve/backup"
|
||||||
|
readonly TODAY_VAR=$(date +%Y%m%d)
|
||||||
|
|
||||||
## Colors
|
## Colors
|
||||||
readonly PURPLE='\033[1;35m'
|
readonly PURPLE='\033[1;35m'
|
||||||
|
@ -96,12 +97,24 @@ main() { # {{{
|
||||||
## Define all vars
|
## Define all vars
|
||||||
define_vars
|
define_vars
|
||||||
|
|
||||||
## Verify if the destination directory is absent {{{
|
## Verify if the local destination directory is absent {{{
|
||||||
### AND create it
|
### AND create it
|
||||||
is_directory_absent "${local_bkp_dir}" \
|
is_directory_absent "${local_bkp_dir}" \
|
||||||
&& mkdir -p -- ${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
|
||||||
|
## }}}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue