diff --git a/README.md b/README.md index eb0c1af..4f5729e 100644 --- a/README.md +++ b/README.md @@ -49,16 +49,20 @@ The backupscript was initially based on the Image-based backup section of [openv is included in the snapshot. Default is no -**--templates=<\yes|no\>** +**--templates=\** If set to yes, we'll also backup our templates. Default is yes -**--exclude=<\veid,veid,veid\>** +**--exclude=\** Allows to exclude certain VEs from being backed up, even if --all is given. Multiple VEIDs can be specified as comma separated list. +**--verbose(=\) + + increase verbosity + ## RESTORE: vzprestore.sh **--all or VEIDs** @@ -89,4 +93,4 @@ The backupscript was initially based on the Image-based backup section of [openv Philipp 'TamCore' Born ## License -[GNU GENERAL PUBLIC LICENSE v2](LICENSE) \ No newline at end of file +[GNU GENERAL PUBLIC LICENSE v2](LICENSE) diff --git a/vzpbackup.sh b/vzpbackup.sh index 7a09d57..30c6a80 100755 --- a/vzpbackup.sh +++ b/vzpbackup.sh @@ -4,6 +4,7 @@ DESTINATION="/vz/backup" KEEP_COUNT=0 SUSPEND="no" +VERBOSE="no" FULL_BACKUP="no" INC_BACKUP="no" VZCTL_PARAM="" @@ -18,13 +19,17 @@ for param in "$@"; do value=${param#*=} case $param in -h|--help) - echo "Usage: $0 [--destination=] [--keep-count=] [--suspend=] [--templates=] [--exclude=] [--full or --inc(cremental)] [--all or VEIDs]" + echo "Usage: $0 [--verbose(=yes)] [--destination=] [--keep-count=] [--suspend=] [--templates=] [--exclude=] [--full or --inc(cremental)] [--all or VEIDs]" echo "Defaults:" echo "- --destination=$DESTINATION" echo "- --keep-count=$KEEP_COUNT" echo "- --suspend=$SUSPEND" + echo "- --verbose=$VERBOSE" exit 0 ;; + --verbose|--verbose=yes) + VERBOSE="yes" + ;; --destination=*) DESTINATION=$value ;; @@ -89,6 +94,10 @@ if [ "$SUSPEND" = "no" ]; then VZCTL_PARAM="$VZCTL_PARAM --skip-suspend" fi +if [ "$VERBOSE" = "yes" ]; then + RSYNC_OPTS="$RSYNC_OPTS --verbose" +fi + # LOCKFILE if [ -f /var/run/vzbackup.pid ] then @@ -133,7 +142,7 @@ if [ "$FULL_BACKUP" = "yes" ]; then fi fi -rsync -avz $RSYNC_OPTS --exclude="/vz/*/*" /vz $DESTINATION +rsync -az $RSYNC_OPTS --exclude="/vz/*/*" /vz $DESTINATION if [ "$FULL_BACKUP" = "yes" ]; then ssh $( echo $DESTINATION | cut -d\: -f1 ) "find $( echo $DESTINATION | cut -d\: -f2 )/* -maxdepth 0 -iname '????.??.??' | head -n -$KEEP_COUNT | xargs rm -rf"