Update db_dumper.pl

This commit is contained in:
Akkadius 2016-08-20 23:23:17 -05:00 committed by GitHub
parent f5a7117bdf
commit afe42ccdaf

View File

@ -32,7 +32,6 @@ if(!$ARGV[0]){
print " database=\"dbname\" - Manually specify databasename, default is database in eqemu_config.xml\n";
print " tables=\"table1,table2,table3\" - Manually specify tables, default is to dump all tables from database\n";
print " compress - Compress Database with 7-ZIP, will fallback to WinRAR depending on what is installed (Must be installed to default program dir)...\n";
print " nolock - Does not lock tables, meant for backuping while the server is running..\n";
print ' Example: perl DB_Dumper.pl Loc="E:\Backups"' . "\n\n";
print "######################################################\n";
exit;
@ -60,9 +59,6 @@ print "Arguments\n" if $Debug;
$n = 0;
while($ARGV[$n]){
print $n . ': ' . $ARGV[$n] . "\n" if $Debug;
if($ARGV[$n]=~/nolock/i){
$no_lock = 1;
}
if($ARGV[$n]=~/compress/i){
print "Compression SET\n";
$Compress = 1;
@ -108,15 +104,12 @@ else {
}
if($t_tables ne ""){
$tables_f_l = substr($t_tables_l, 0, 20) . '...';
$tables_f_l = substr($t_tables_l, 0, 20) . '-';
$target_file = '' . $tables_f_l . '_' . $date . '';
print "Performing table based backup...\n";
#::: Backup Database...
print "Backing up Database " . $db . "... \n\n";
if($no_lock == 1){
$added_parameters .= " --skip-lock-tables ";
}
$cmd = 'mysqldump -u' . $user . ' --host ' . $host . ' ' . $added_parameters . ' --max_allowed_packet=512M --password="' . $pass . '" ' . $db . ' ' . $t_tables . ' > "' . $B_LOC[1] . '' . $file_app . '' . $target_file . '.sql"';
$cmd = 'mysqldump -u' . $user . ' --host ' . $host . ' --max_allowed_packet=512M --password="' . $pass . '" ' . $db . ' ' . $t_tables . ' > "' . $B_LOC[1] . '' . $file_app . '' . $target_file . '.sql"';
printcmd($cmd);
system($cmd);
}
@ -124,10 +117,7 @@ else{ #::: Entire DB Backup
$target_file = '' . $db . '_' . $date . '';
#::: Backup Database...
print "Backing up Database " . $db . "... \n\n";
if($no_lock == 1){
$added_parameters .= " --skip-lock-tables ";
}
$cmd = 'mysqldump -u' . $user . ' --host ' . $host . ' ' . $added_parameters . ' --max_allowed_packet=512M --password="' . $pass . '" ' . $db . ' > "' . $B_LOC[1] . '' . $file_app . '' . $target_file . '.sql"';
$cmd = 'mysqldump -u' . $user . ' --host ' . $host . ' --max_allowed_packet=512M --password="' . $pass . '" ' . $db . ' > "' . $B_LOC[1] . '' . $file_app . '' . $target_file . '.sql"';
printcmd($cmd);
system($cmd);
}