add --verbose(=yes)

This commit is contained in:
TamCore 2015-07-06 13:26:23 +02:00
parent 0ab1cc6e57
commit f1663b4e2f
No known key found for this signature in database
GPG key ID: 9AE694D84D80BF88
2 changed files with 18 additions and 5 deletions

View file

@ -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=\<yes|no\>**
If set to yes, we'll also backup our templates.
Default is yes
**--exclude=<\veid,veid,veid\>**
**--exclude=\<veid,veid,veid\>**
Allows to exclude certain VEs from being backed up, even if --all is given.
Multiple VEIDs can be specified as comma separated list.
**--verbose(=\<yes\>)
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 <philipp {at} tamcore {dot} eu>
## License
[GNU GENERAL PUBLIC LICENSE v2](LICENSE)
[GNU GENERAL PUBLIC LICENSE v2](LICENSE)

View file

@ -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=<backup-destination>] [--keep-count=<keep count>] [--suspend=<yes|no>] [--templates=<yes|no>] [--exclude=<VEID>] [--full or --inc(cremental)] [--all or VEIDs]"
echo "Usage: $0 [--verbose(=yes)] [--destination=<backup-destination>] [--keep-count=<keep count>] [--suspend=<yes|no>] [--templates=<yes|no>] [--exclude=<VEID>] [--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"