From 1e5fd8fcd03567326036f2f9cdfa3ba45b5d69be Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 19 Jan 2018 12:03:29 +0000 Subject: [PATCH 1/2] Added filename option --- README.md | 5 +++++ vzpbackup.sh | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 3a60192..b50de34 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Usage: ./vzpbackup.sh [--suspend=] [--backup-dir=] [--work-dir=] + [--filename=] [--compress=] [--compact] [--all] @@ -48,6 +49,10 @@ Options: Parameter to change the default working directory. Either use the parameter or change the script. +--filename=\ (Default: vzpbackup_+hostname_+CTID+_containerhostname_+timestamp) + + Parameter top change the default backup filename + --compact Runs vzctl compact for each container before initiating diff --git a/vzpbackup.sh b/vzpbackup.sh index 744f721..fcabc5c 100755 --- a/vzpbackup.sh +++ b/vzpbackup.sh @@ -27,6 +27,7 @@ BACKUP_DIR=/store/vzpbackup WORK_DIR=/store/vzpbackup COMPRESS=no COMPACT=0 +FILENAME ## ## VARIABLES @@ -67,6 +68,7 @@ Usage: $0 \t[--suspend=] \t[--backup-dir=] \t[--work-dir=] +\t[--filename=] \t[--compress=] \t[--compact] \t[--all] @@ -81,6 +83,7 @@ show_param() { echo -e "SUSPEND: \t\t$SUSPEND" echo -e "BACKUP_DIR: \t\t$BACKUP_DIR" echo -e "WORK_DIR: \t\t$WORK_DIR" + echo -e "FILENAME: \t\t$FILENAME" echo -e "COMPRESS: \t\t$COMPRESS" echo -e "COMPACT: \t\t$COMPACT" echo -e "CTIDs to backup: \t\t$CTIDS" @@ -118,6 +121,9 @@ case $i in --work-dir=*) WORK_DIR=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` ;; + --filename=*) + FILENAME=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` + ;; --compress=*) COMPRESS=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` ;; @@ -191,7 +197,11 @@ if grep -w "$CTID" <<< `$VZLIST_CMD -a -Hoctid` &> /dev/null; then # a possible the dump (while being suspended) and container config cd $VE_PRIVATE HNAME=`$VZLIST_CMD -Hohostname $CTID` + + if [ -z "$FILENAME" ]; then FILENAME="${PREFIX}${CTID}_${HNAME}_${TIMESTAMP}" + fi + COMPRESS_SUFFIX="" if [ "$COMPRESS" == "tgz" ]; then From 0804bf3858200b3d6643749dc61dbc8fdbea17e3 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 19 Jan 2018 16:20:15 +0000 Subject: [PATCH 2/2] Spelling fx --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b50de34..52b6efd 100644 --- a/README.md +++ b/README.md @@ -49,10 +49,10 @@ Options: Parameter to change the default working directory. Either use the parameter or change the script. ---filename=\ (Default: vzpbackup_+hostname_+CTID+_containerhostname_+timestamp) +--filename=\ (Default: vzpbackup+_hostname_+CTID+_containerhostname_+timestamp) + + Parameter to change the default backup filename - Parameter top change the default backup filename - --compact Runs vzctl compact for each container before initiating