Hello,
I am writing a program that backups up databases. I am having
trouble tarring up the directories. Tarring files using Archive::Tar is
pretty straight forward, but tarring directories, I am having issues:
here is part of the code..
$datadir = "/var/lib/mysql/";
$dbQuery = qq(
SHOW DATABASES
);
$dbQuery = $dbh->prepare($dbQuery);
$dbQuery->execute();
while (my $db = $dbQuery->fetchrow_array()) {
push @dbs, $datadir.$db;
}
$dbQuery->finish();
print "Found data directories in: @dbs\n" if (DEBUG);
# lock all tables and flush all data
print "Locking all tables.\n" if (DEBUG);
$lockQuery = qq(
FLUSH TABLES WITH READ LOCK
);
$lockQuery = $dbh->prepare($lockQuery);
$lockQuery->execute();
# backup up the databases
Archive::Tar->create_archive ("/home/backup/$name-db.tar.gz", 9, glob
"@dbs/*");
# don't finish or disconnect till after the tar.
$lockQuery->finish();
$rc = $dbh->disconnect();
Everything runs smoothly except when a view the tar ball, it appears I
only get the globbing on the last db of the array. I get the
directories of the other dbs, just not the contents/files inside the
directory. Can anyone point out what I am missing? I would appreciate
it.
Thanks,
Chad
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]