#!/bin/bash

# tasks for regular maintenance of the NTVMR

#move latest full backup out of weekly rotation to monthly rotation and keep at most 4 monthly backups
cd /data/backups
LATEST=`ls -t full-backup-*.tar.gz|head -1`
MONTHLY=monthly-`echo $LATEST|cut -d- -f2-`
mv $LATEST $MONTHLY
if [ `ls -t monthly-backup-*.tar.gz|wc -l` -gt 4 ]; then rm -f `ls -t monthly-backup-*.tar.gz|tail -1`; fi

#mirror monthlies and images to a second backup server
./mirror.sh &
