[BlueOnyx:07888] Making raqbackup.sh keep more than one backup

Richard Morgan richard at morgan-web.co.uk
Thu Jul 28 06:58:01 -05 2011


I had a little problem recently where a client accidently deleted some files from their webspace and didn't ask about backups for a few days - not directly my problem, but raqbackup.sh only keeps a day or two.

I've tweaked raqbackup.sh with some tiny adjustments and thought I'd post it in case it was useful to anyone else - plus I'll know where to find my own code in the future :o)

Usual caveats: no guarantees and test it thoroughly before trusting it.  It doesn't do the same level of checking as the full raqbackup.sh script, but it should be reliable.  I've tested it on Neuhaus's standard script but and Solarspeed's version too.  Seems OK, but I suggest testing and watching to make sure it's all as expected.

Richard.

---

To make raqbackup.sh keep more than two backups:

Take a backup copy of raqbackup.sh and keep it safe.

Edit raqbackup.sh

In function ftptest()

Add the following under $FTPPREPARE1

mkdir $SOURCE.bak2
mkdir $SOURCE.bak1
mkdir $SOURCE.bak0

In the function ftpbackup()

Change the following line which all appear within a few lines of $FTPPREPARE1

>From 'cd $SOURCE.bak' to 'cd $SOURCE.bak2'
>From 'rmdir $SOURCE.bak' to 'rmdir $SOURCE.bak2'

Below the new 'rmdir $SOURCE.bak2' line add the following to shuffle the previous backups along a bit:

rename $SOURCE.bak1 $SOURCE.bak2
rename $SOURCE.bak0 $SOURCE.bak1
rename $SOURCE.bak $SOURCE.bak0

Done, that's now complete and the backup will keep five backups not just two.  If there is lots of storage space this could be extended.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.blueonyx.it/pipermail/blueonyx/attachments/20110728/99db4f87/attachment.html>


More information about the Blueonyx mailing list