Monday, December 20, 2010

Automatically backup a Rivendell database

I have just discovered that there is a Rivendell Macro for backing up
a database as often as you wish.

DATABASE BACKUP

Mnemonic: DB
Syntax:
DB !
Create a backup copy of the active Rivendell database in .

On my set up I made a new macro called back up database. It has only 2
lines in it.

DB /home/geoff/Downloads/RivendellBackUp/RD-Backup.sql!
RN /home/geoff/Downloads/RivendellBackUp/datestamp.sh!

The first line makes a new sql file called RD-backup.sql
The second line runs a shell script that renames the backup sql file
to the current day's date.

#!/bin/bash

#Special program to rename the current database back up with todays date.

#NOTE If sharing created files with windows users Colons eg : cannot be in filenames
#I suggest doing the date variable creation like this.
# currentdate=`date +%F-%H.%M.%S`
currentdate=`date +%F-%X`

sleep 30
mv ~/Downloads/RivendellBackUp/RD-Backup.sql
~/Downloads/RivendellBackUp/RD-$currentdate.sql


Note
I found that sometimes the Rivendell macros crash rdairplay so I now run from a command line the following script..... 


#!/bin/bash

currentdate=`date +%F-%X`

echo $currentdate

mysqldump -u rduser -pletmein --lock-tables=false Rivendell > /home/geoff/rivendell-backup/RD-$currentdate.sql



You can set up this macro to run daily weekly or whenever.

No comments: