Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Ploop/Backup

11 bytes added, 09:16, 9 October 2013
Image-based backup: The sorting of files was wrong. Now it lists the folders by date not by name.
if [ -z $1 -o -z $2 ]
then
echo "Usage: vzbackup CTID BACKUP-PATH" exit 1
fi
ID=$(uuidgen)
VE_PRIVATE=$(VEID=$CTID; source /etc/vz/vz.conf; source /etc/vz/conf/$CTID.conf; echo $VE_PRIVATE)
# Take a snapshot without suspending a CT and saving its config
vzctl snapshot $CTID --id $ID --skip-suspend --skip-config
# Perform a backup using your favorite backup tool
# (cp is just an example)
cp $VE_PRIVATE/root.hdd/* $BACKUPPATH/
# Delete (merge) the snapshot
vzctl snapshot-delete $CTID --id $ID
# remove old backups
rm -rf $( find $FOLDER -type d -name "$CTID*" -exec ls -d1rt "{}" + | head -n-4 )
echo "BACKUP FINISHED."
2
edits