I have the following in a shell script (#!/bin/bash) to rotate some
backups:
if [ "`date +%d`" -eq 1 ]
then
[ -d ${BAKLOC}.monthly.3 ] && rm -rf ${BAKLOC}.monthly.3
[ -d ${BAKLOC}.monthly.2 ] && mv ${BAKLOC}.mothly.2 $
{BAKLOC}.monthly.3
[ -d ${BAKLOC}.monthly.1 ] && mv ${BAKLOC}.mothly.1 $
{BAKLOC}.monthly.2
[ -d ${BAKLOC}.monthly.0 ] && mv ${BAKLOC}.mothly.0 $
{BAKLOC}.monthly.1
[ -d ${BAKLOC}.weekly.3 ] && mv ${BAKLOC}.weekly.3 $
{BAKLOC}.monthly.0
fi
It appeared to have worked the first time I ran it, but has not worked
since. date +%d returns '01' on the first of the month. The only
other option is %e which returns ' 1' on the first.
this block works to rotate the weekly backups:
if [ "`date +%w`" -eq 0 ]
then
[ -d ${BAKLOC}.weekly.3 ] && rm -rf ${BAKLOC}.weekly.3
[ -d ${BAKLOC}.weekly.2 ] && mv ${BAKLOC}.weekly.2 $
{BAKLOC}.weekly.3
[ -d ${BAKLOC}.weekly.1 ] && mv ${BAKLOC}.weekly.1 $
{BAKLOC}.weekly.2
[ -d ${BAKLOC}.weekly.0 ] && mv ${BAKLOC}.weekly.0 $
{BAKLOC}.weekly.1
[ -d ${BAKLOC}.daily.6 ] && mv ${BAKLOC}.daily.6 $
{BAKLOC}.weekly.0
fi
--
Lobotomy means never having to say you're sorry -- or anything
else.
--
You are responsible for your Rose
_______________________________________________
OSX-Nutters mailing list | [email protected]
http://lists.tit-wank.com/mailman/listinfo/osx-nutters
List hosted at http://cat5.org/