Installation

  • apt-get install rsync

Create SSH Keys

backup file

#!/bin/sh

#
# ZODB
#

PYTHON_DIR=/home/plone/Plone-3.1/Python-2.4/bin/python
REPOZO_FILE=/home/plone/Plone-3.1/zinstance/bin/repozo
ZODB_FILE=/home/plone/Plone-3.1/zinstance/var/filestorage/Data.fs

REMOTE_USER=nathan
REMOTE_HOST=76.222.67.149
REMOTE_PATH=/home/nathan/plonebackups/linode/datafs
LOCAL_PATH=/home/plone/Plone-3.1/zinstance/backups/

echo "backing up plone zodb"
$PYTHON_DIR $REPOZO_FILE -Bvz -r $LOCAL_PATH -f $ZODB_FILE
echo "using rsync to backup to home server"
rsync --delete -azvv -e ssh $LOCAL_PATH $REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH
echo "completed successfully"

#
# BUILDOUT
#
LOCAL_BUILDOUT=/home/plone/Plone-3.1/zinstance/buildout.cfg
REMOTE_BUILDOUT=/home/nathan/plonebackups/linode/settings/buildout.cfg

echo "backing up buildout"
rsync --delete -azvv -e ssh $LOCAL_BUILDOUT $REMOTE_USER@$REMOTE_HOST:$REMOTE_BUILDOUT

#
# PRODUCTS
#
LOCAL_PRODUCTS=/home/plone/Plone-3.1/zinstance/products
REMOTE_PRODUCTS=/home/nathan/plonebackups/linode/products

echo "backing up products"
rsync --delete -azvv -e ssh $LOCAL_PRODUCTS $REMOTE_USER@$REMOTE_HOST:$REMOTE_PRODUCTS

#
# eggs
#
LOCAL_EGGS=/home/plone/Plone-3.1/buildout-cache/eggs
REMOTE_EGGS=/home/nathan/plonebackups/linode/eggs

echo "backing up eggs"
rsync --delete -azvv -e ssh $LOCAL_EGGS $REMOTE_USER@$REMOTE_HOST:$REMOTE_EGGS

 

Cron Jobs

  • crontab -e
  • 0 3 * * * sh /path/to/script