#!/usr/bin/perl -w use strict; use Getopt::Long; use File::Find; use File::Copy; #------------------------------------------------- # configuration #------------------------------------------------- my $show_help=0; my $tmp="/tmp"; #------------------------------------------------- # get configuration overides from cmd line #------------------------------------------------- GetOptions ( 'help', \$show_help, 'temp=s', \$tmp, ); #------------------------------------------------- # Show help? #------------------------------------------------- if ($show_help) { print < $tmp/new.mysql`; #extract older dump copy("$tbl.mysql.bz2", "$tmp/old.mysql.bz2"); `bunzip2 $tmp/old.mysql.bz2`; #diff them my $diff=`diff --brief $tmp/new.mysql $tmp/old.mysql`; if ($diff =~ /differ/) { unlink("$tbl.mysql.bz2"); copy("$tmp/new.mysql", "$tbl.mysql"); `bzip2 $tbl.mysql`; $updates++; print "UPDATED\n"; } else { print "OK\n"; } #cleanup unlink("$tmp/new.mysql"); unlink("$tmp/old.mysql"); } } #------------------------------------------------- # Process tables... #------------------------------------------------- print "\n"; find(\&ProcessFile, "./"); print "\n"; if ($updates) { print "$updates table dumps updated - you should commit these to CVS\n\n"; }