RRR database backup

The RRR database that is located on paio is backed up using mysqldump from gallah. To this aim, access to the database was granted following the instructions on this tutorial

http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html

Perl script used to backup RRR database on paio from gallah

  • This script is on gallah in /usr/local/backup, and has been added to /etc/cron.daily so it runs every day.
  • It is run by the user mysql on gallah, and it saves daily dumps at /usr/local/backup/paio
#!/usr/bin/perl

# keep 7 days worth of mysqldump.
# a tape based snapshot of the structure of this may not
# be reliable. TK

my $date=`/bin/date "+%Y%m%d"`;chomp($date);
my $deldate=`date --date="7 days ago" "+%Y%m%d"`;chomp($deldate);
my $x;
#indicate database user and password on the following line
my $mydump = "/usr/bin/mysqldump -A -R  --user= *** --password= *** --host=192.168.122.70";
my $mytar  = "/bin/tar -chjf";
my $compress = "/bin/gzip -9 ";

$x="$mydump | $compress > /usr/local/backup/paio/$date-mysql.gz";
system($x);

unlink "/usr/local/backup/$host/$deldate-mysql.gz";