#!/usr/bin/perl
## DB info struct
##{ host, db, username, password}
@DBsToBackup =(
##host 1
['localhost', 'testlink', 'root', 'testlink']
##host 2
#['192.168.0.2', 'database5', 'username', 'password']
);
$backupdir = 'C:\\TestlinkDBBackup';
print "Starting dump of databases...\n\n";
foreach $dbinfo (@DBsToBackup){
($Second, $Minute, $Hour, $Day, $Month, $Year, $WeekDay, $DayOfYear, $IsDST) = localtime(time) ;
$Year += 1900 ; $Month += 1;
$outputFilename = sprintf("%04d%02d%02d[%02d%02d%02d]", $Year, $Mont...
Continue reading...
Posted by Blogger Tech. Posted In : Testlink
Here is the PHP script for getting the backup of Test Link database:-
#################################################
<?php
$host = "localhost";
$database = "<DBName>";
$user = "<User Name>";
$pass = "<Password>";
$dbh = mysql_connect($host, $user, $pass) or die ("Can't connect to MySQL");
mysql_select_db($database) or die ("Can't connect to db");
$bckp_file = $database.date("Y-m-d-H-i-s").".sql";
...$command = "mysqldump -h$host -u$user -p$pass $database > $bckp_file";
$database > $bckp_file;