Changeset 7381
- Timestamp:
- 11/08/04 12:52:04 (4 years ago)
- Files:
-
- trunk/src/tools/backup/nnbup_create_archive.pl (modified) (5 diffs)
- trunk/src/tools/backup/nnbup_main.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/tools/backup/nnbup_create_archive.pl
r7018 r7381 28 28 if (!$backupDir) { $backupDir=$val; } else { print "NOTICE: BackupDir already defined, cannot redefine\n"; } 29 29 if (!(substr($backupDir,-1,1)eq"/")) { $backupDir.="/"; } 30 } elsif ($op eq 'verbose') { 31 $opmatch=1; 32 $verbose=1; 30 33 } elsif ($op eq 'archiveid') { 31 34 $opmatch=1; … … 40 43 $cmd.=" -p'$mysqlPwd'"; 41 44 } 42 print "INFO: Backing up MySQL database '$val'\n";45 if ($verbose==1) { print "INFO: Backing up MySQL database '$val'\n"; } 43 46 $pathFile=$backupDir.$val."_backup_".$time_hr.".sql"; 44 47 $cnt=@files; … … 56 59 } elsif ($op eq 'dir') { 57 60 $opmatch=1; 58 print "INFO: Backing up directory '$val'\n";61 if ($verbose==1) { print "INFO: Backing up directory '$val'\n"; } 59 62 if (substr($val,0,1) eq "/") { $dirSafe=substr($val,1); } else { $dirSafe=$val; } 60 63 $_=$dirSafe; … … 67 70 $cnt=@files_wopath; 68 71 @files_wopath[$cnt]=$file; 69 $cmd="tar -cvf '".$pathFile."' '$val'"; 72 if ($verbose==1) { 73 $cmd="tar -cvf '".$pathFile."' '$val'"; 74 } else { 75 $cmd="tar -cf '".$pathFile."' '$val'"; 76 } 70 77 } 71 78 if (!$opmatch) { … … 83 90 $pathMainarchive=$backupDir.$time_hr."_".$archiveId.".tar.bz2"; 84 91 85 $cmd="cd $backupDir; tar -cvjf ".$pathMainarchive." @files_wopath"; 86 print "INFO: Compressing the main archive (this might take a while)\n"; 92 if ($verbose==1) { 93 $cmd="cd $backupDir; tar -cvjf ".$pathMainarchive." @files_wopath"; 94 } else { 95 $cmd="cd $backupDir; tar -cjf ".$pathMainarchive." @files_wopath"; 96 } 97 if ($verbose==1) { print "INFO: Compressing the main archive (this might take a while)\n"; } 87 98 #print "DEBUG: main tar.bz2 cmd='$cmd'\n"; 88 99 system($cmd); 89 100 $rmcmd="rm -f @files"; 90 print "INFO: Removing temporary files\n"; 101 if ($verbose==1) { print "INFO: Removing temporary files\n"; } 91 102 #print "DEBUG: rmcmd='$rmcmd'\n"; 92 103 system ($rmcmd); trunk/src/tools/backup/nnbup_main.pl
r7018 r7381 42 42 $opmatch=1; 43 43 if (!$archiveId) { $archiveId=$val; } else { print "NOTICE: ArchiveID already defined, cannot redefine\n"; } 44 } elsif ($op eq 'verbose') { 45 $opmatch=1; 46 $verbose=1; 44 47 } 45 48 if (!$opmatch) { … … 58 61 59 62 if ($monthday==$monthlyDay) { #It's time to make also a monthly copy 60 print "INFO: Copying todays archive to monthly archives\n";63 if ($verbose==1) { print "INFO: Copying todays archive to monthly archives\n"; } 61 64 $month_hr=($year+1900).sprintf("%02d%02d",($month+1, $monthday)); 62 65 $pathFile=$backupDir."Monthly-".$month_hr."_".$archiveId.".tar.bz2"; … … 67 70 68 71 # *** NEXT UP: Go trough existing files and eliminate old ones 69 printf ("INFO: Clearing files older than %d days\n",$keepDays); 72 if ($verbose==1) { printf ("INFO: Clearing files older than %d days\n",$keepDays); } 70 73 if ($backupDir) { 71 74 $_=$backupDir;
