#!/bin/sh
DATADIR=/home/data
DATABACKDIR=/home/data/databackup
CURDIR=`pwd`
YEAR=`date +%Y`
cd $DATADIR
BACKUPFILES=`ls *$YEAR-*`
mkdir -p $DATABACKDIR
for backupfile in $BACKUPFILES
do
tar cjvf $backupfile.tar.bz2 $backupfile
rm -f $backupfile
mv $backupfile.tar.bz2 $DATABACKDIR
done
cd $DATADIR