X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=bin%2FBackupPC;h=964640e4178df97d7bad7d50ad0d5a45d6ee82dd;hb=c0f0e743da5d40baf69d4330d8ccc0f4112a081f;hp=5c17c2be9d270680308893907ceab1fb568ff9ff;hpb=1ce7d1541ea1279aaa0a75c16986a3fd40b608ec;p=BackupPC.git diff --git a/bin/BackupPC b/bin/BackupPC index 5c17c2b..964640e 100755 --- a/bin/BackupPC +++ b/bin/BackupPC @@ -47,7 +47,7 @@ # #======================================================================== # -# Version 1.5.0, released 2 Aug 2002. +# Version 1.6.0_CVS, released 10 Dec 2002. # # See http://backuppc.sourceforge.net. # @@ -55,7 +55,7 @@ use strict; use vars qw(%Status %Info $Hosts); -use lib "__INSTALLDIR__/lib"; +use lib "/usr/local/BackupPC/lib"; use BackupPC::Lib; use BackupPC::FileZIO; @@ -307,16 +307,16 @@ sub Main_Initialize # Requeue any pending links. # foreach my $host ( sort(keys(%$Hosts)) ) { - if ( $Status{$host}{state} eq "backup in progress" ) { + if ( $Status{$host}{state} eq "Status_backup_in_progress" ) { # # should we restart it? skip it for now. # - $Status{$host}{state} = "idle"; - } elsif ( $Status{$host}{state} eq "link pending" - || $Status{$host}{state} eq "link running" ) { + $Status{$host}{state} = "Status_idle"; + } elsif ( $Status{$host}{state} eq "Status_link_pending" + || $Status{$host}{state} eq "Status_link_running" ) { QueueLink($host); } else { - $Status{$host}{state} = "idle"; + $Status{$host}{state} = "Status_idle"; } $Status{$host}{activeJob} = 0; } @@ -432,7 +432,7 @@ sub Main_TryToRun_CmdQueue $Jobs{$host}{reqTime} = $req->{reqTime}; $Jobs{$host}{cmd} = $cmd; $Jobs{$host}{type} = $Status{$host}{type}; - $Status{$host}{state} = "link running"; + $Status{$host}{state} = "Status_link_running"; $Status{$host}{activeJob} = 1; $Status{$host}{endTime} = time; $CmdJob = $host if ( $host ne $bpc->trashJob ); @@ -564,7 +564,7 @@ sub Main_TryToRun_Bg_or_User_Queue $Jobs{$host}{user} = $user; $Jobs{$host}{type} = $type; if ( !$req->{dhcp} ) { - $Status{$host}{state} = "$type starting"; + $Status{$host}{state} = "Status_".$type."_starting"; $Status{$host}{activeJob} = 1; $Status{$host}{startTime} = time; $Status{$host}{endTime} = ""; @@ -788,7 +788,7 @@ sub Main_Check_Job_Messages $Jobs{$newHost} = $Jobs{$host}; delete($Jobs{$host}); $host = $newHost; - $Status{$host}{state} = "backup starting"; + $Status{$host}{state} = "Status_backup_starting"; $Status{$host}{activeJob} = 1; $Status{$host}{startTime} = $Jobs{$host}{startTime}; $Status{$host}{endTime} = ""; @@ -796,10 +796,11 @@ sub Main_Check_Job_Messages } else { print(LOG $bpc->timeStamp, "dhcp $host: $mesg\n"); } - } elsif ( $mesg =~ /^started (.*) dump, pid=(\d+), tarPid=(-?\d+)/ ) { - $Jobs{$host}{type} = $1; - $Jobs{$host}{xferPid} = $2; - $Jobs{$host}{tarPid} = $3; + } elsif ( $mesg =~ /^started (.*) dump, pid=(-?\d+), tarPid=(-?\d+), share=(.*)/ ) { + $Jobs{$host}{type} = $1; + $Jobs{$host}{xferPid} = $2; + $Jobs{$host}{tarPid} = $3; + $Jobs{$host}{shareName} = $4; print(LOG $bpc->timeStamp, "Started $1 backup on $host" . " (pid=$Jobs{$host}{pid}, xferPid=$2", @@ -807,8 +808,8 @@ sub Main_Check_Job_Messages ? ", tarPid=$Jobs{$host}{tarPid}" : "", $Jobs{$host}{dhcpHostIP} ? ", dhcp=$Jobs{$host}{dhcpHostIP}" : "", - ")\n"); - $Status{$host}{state} = "backup in progress"; + ", share=$Jobs{$host}{shareName})\n"); + $Status{$host}{state} = "Status_backup_in_progress"; $Status{$host}{reason} = ""; $Status{$host}{type} = $1; $Status{$host}{startTime} = time; @@ -826,7 +827,7 @@ sub Main_Check_Job_Messages $Jobs{$host}{tarPid} > 0 ? ", tarPid=$Jobs{$host}{tarPid}" : "", ")\n"); - $Status{$host}{state} = "restore in progress"; + $Status{$host}{state} = "Status_restore_in_progress"; $Status{$host}{reason} = ""; $Status{$host}{type} = "restore"; $Status{$host}{startTime} = time; @@ -834,27 +835,27 @@ sub Main_Check_Job_Messages $Status{$host}{aliveCnt}++; } elsif ( $mesg =~ /^(full|incr) backup complete/ ) { print(LOG $bpc->timeStamp, "Finished $1 backup on $host\n"); - $Status{$host}{reason} = "backup done"; + $Status{$host}{reason} = "Reason_backup_done"; delete($Status{$host}{error}); delete($Status{$host}{errorTime}); $Status{$host}{endTime} = time; } elsif ( $mesg =~ /^restore complete/ ) { print(LOG $bpc->timeStamp, "Finished restore on $host\n"); - $Status{$host}{reason} = "restore done"; + $Status{$host}{reason} = "Reason_restore_done"; delete($Status{$host}{error}); delete($Status{$host}{errorTime}); $Status{$host}{endTime} = time; } elsif ( $mesg =~ /^nothing to do/ ) { - $Status{$host}{state} = "idle"; - $Status{$host}{reason} = "nothing to do"; + $Status{$host}{state} = "Status_idle"; + $Status{$host}{reason} = "Reason_nothing_to_do"; $Status{$host}{startTime} = time; $Status{$host}{dhcpCheckCnt}-- if ( $Status{$host}{dhcpCheckCnt} > 0 ); } elsif ( $mesg =~ /^no ping response/ || $mesg =~ /^ping too slow/ ) { - $Status{$host}{state} = "idle"; - if ( $Status{$host}{reason} ne "backup failed" ) { - $Status{$host}{reason} = "no ping"; + $Status{$host}{state} = "Status_idle"; + if ( $Status{$host}{reason} ne "Reason_backup_failed" ) { + $Status{$host}{reason} = "Reason_no_ping"; $Status{$host}{startTime} = time; } $Status{$host}{deadCnt}++; @@ -862,8 +863,8 @@ sub Main_Check_Job_Messages $Status{$host}{aliveCnt} = 0; } } elsif ( $mesg =~ /^dump failed: (.*)/ ) { - $Status{$host}{state} = "idle"; - $Status{$host}{reason} = "backup failed"; + $Status{$host}{state} = "Status_idle"; + $Status{$host}{reason} = "Reason_backup_failed"; $Status{$host}{error} = $1; $Status{$host}{errorTime} = time; $Status{$host}{endTime} = time; @@ -881,6 +882,7 @@ sub Main_Check_Job_Messages $Info{"$f[0]FileCntRep"} = $f[7]; $Info{"$f[0]FileRepMax"} = $f[8]; $Info{"$f[0]FileCntRename"} = $f[9]; + $Info{"$f[0]FileLinkMax"} = $f[10]; $Info{"$f[0]Time"} = time; printf(LOG "%s%s nightly clean removed %d files of" . " size %.2fGB\n", @@ -888,11 +890,12 @@ sub Main_Check_Job_Messages $Info{"$f[0]FileCntRm"}, $Info{"$f[0]KbRm"} / (1000 * 1024)); printf(LOG "%s%s is %.2fGB, %d files (%d repeated, " - . "%d max chain), %d directories\n", + . "%d max chain, %d max links), %d directories\n", $bpc->timeStamp, ucfirst($f[0]), $Info{"$f[0]Kb"} / (1000 * 1024), $Info{"$f[0]FileCnt"}, $Info{"$f[0]FileCntRep"}, - $Info{"$f[0]FileRepMax"}, $Info{"$f[0]DirCnt"}); + $Info{"$f[0]FileRepMax"}, + $Info{"$f[0]FileLinkMax"}, $Info{"$f[0]DirCnt"}); } elsif ( $mesg =~ /^BackupPC_nightly lock_off/ ) { $RunNightlyWhenIdle = 0; } elsif ( $mesg =~ /^processState\s+(.+)/ ) { @@ -914,7 +917,7 @@ sub Main_Check_Job_Messages my $cmd = $Jobs{$host}{cmd}; $cmd =~ s/$BinDir\///g; print(LOG $bpc->timeStamp, "Finished $host ($cmd)\n"); - $Status{$host}{state} = "idle"; + $Status{$host}{state} = "Status_idle"; $Status{$host}{endTime} = time; $CmdJob = ""; $RunNightlyWhenIdle = 0 if ( $cmd eq "BackupPC_nightly" @@ -925,11 +928,11 @@ sub Main_Check_Job_Messages # processing for this host. # if ( defined($Status{$host}) - && ($Status{$host}{reason} eq "backup done" + && ($Status{$host}{reason} eq "Reason_backup_done" || $Status{$host}{needLink}) ) { QueueLink($host); } elsif ( defined($Status{$host}) ) { - $Status{$host}{state} = "idle"; + $Status{$host}{state} = "Status_idle"; } } delete($Jobs{$host}); @@ -1020,8 +1023,8 @@ sub Main_Check_Client_Messages vec($FDread, $Jobs{$host}{fn}, 1) = 0; close($Jobs{$host}{fh}); delete($Jobs{$host}); - $Status{$host}{state} = "idle"; - $Status{$host}{reason} = "backup canceled by $user"; + $Status{$host}{state} = "Status_idle"; + $Status{$host}{reason} = "Reason_backup_canceled_by_user"; #FIXME: user should be $user (we need to substitute the variable in the l10n stuff) $Status{$host}{activeJob} = 0; $Status{$host}{startTime} = time; $reply = "ok: backup of $host cancelled"; @@ -1326,7 +1329,7 @@ sub QueueLink my($host) = @_; return if ( $CmdQueueOn{$host} ); - $Status{$host}{state} = "link pending"; + $Status{$host}{state} = "Status_link_pending"; $Status{$host}{needLink} = 0; unshift(@CmdQueue, { host => $host, @@ -1366,7 +1369,7 @@ sub HostsUpdate # foreach my $host ( sort(keys(%$Hosts)) ) { next if ( defined($Status{$host}) ); - $Status{$host}{state} = "idle"; + $Status{$host}{state} = "Status_idle"; print(LOG $bpc->timeStamp, "Added host $host to backup list\n"); } foreach my $host ( sort(keys(%Status)) ) {