Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Usage: ./vzpbackup.sh
[--suspend=<yes/no>]
[--backup-dir=<Backup-Directory>]
[--work-dir=<Temp-Directory>]
[--filename=<final name of the file>]
[--compress=<no/pz/bz/pbz/tbz/gz/tgz/xz/txz>]
[--compact]
[--all]
Expand Down Expand Up @@ -48,6 +49,10 @@ Options:
Parameter to change the default working directory. Either
use the parameter or change the script.

--filename=\<File name> (Default: vzpbackup+_hostname_+CTID+_containerhostname_+timestamp)

Parameter to change the default backup filename

--compact

Runs vzctl compact for each container before initiating
Expand Down
10 changes: 10 additions & 0 deletions vzpbackup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ BACKUP_DIR=/store/vzpbackup
WORK_DIR=/store/vzpbackup
COMPRESS=no
COMPACT=0
FILENAME

##
## VARIABLES
Expand Down Expand Up @@ -67,6 +68,7 @@ Usage: $0
\t[--suspend=<yes/no>]
\t[--backup-dir=<Backup-Directory>]
\t[--work-dir=<Temp-Directory>]
\t[--filename=<final name of the backup file>]
\t[--compress=<no/pz/bz/pbz/tbz/gz/tgz/xz/txz>]
\t[--compact]
\t[--all]
Expand 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"
Expand Down Expand Up @@ -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]*=//'`
;;
Expand Down Expand Up @@ -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
Expand Down