//
you're reading...
OpenVZ

VE Backup Script

Here’s a simple script I use to backup my VE’s.

#!/bin/bash

BKUP_DIR='/somewhere/to/store/tarballs'

if [ ! -z "$1" ]; then
    LIST=$1
else
    LIST=`/usr/sbin/vzlist | awk '{print $1}' | grep -v CTID`
fi

for i in $LIST; do
    /usr/sbin/vzdump --dumpdir $BKUP_DIR --snapshot $i
done

This will create tarballs of the containers, you can pass it a CTID to only backup one container.

Advertisements

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s