Subversion Repositories zfs_utils

Rev

Rev 20 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 20 Rev 21
Line 147... Line 147...
147
      }
147
      }
148
   }
148
   }
149
   # not on remote machine, so give them waitTime seconds to put it here
149
   # not on remote machine, so give them waitTime seconds to put it here
150
   # we'll loop, checking every $sleepTime seconds until our wait time
150
   # we'll loop, checking every $sleepTime seconds until our wait time
151
   # ($configuration->{'target'}->{'waitTime'}) has expired
151
   # ($configuration->{'target'}->{'waitTime'}) has expired
-
 
152
   # set default of 3 minutes if waitTime not set
-
 
153
   $configuration->{'target'}->{'waitTime'} = 300 unless $configuration->{'target'}->{'waitTime'};
-
 
154
   # we will check every $sleepTime seconds (ie, every minute)
152
   my $sleepTime = 60;
155
   my $sleepTime = 60;
153
   for ( my $i = $configuration->{'target'}->{'waitTime'}; $i > 0; $i -= $sleepTime ) {
156
   for ( my $i = $configuration->{'target'}->{'waitTime'}; $i > 0; $i -= $sleepTime ) {
154
      sleep $sleepTime;
157
      sleep $sleepTime;
155
      # then look for the maintenance flag file on the local machine
158
      # then look for the maintenance flag file on the local machine
156
      return "Maintenance Flag found on local machine" if -f $configuration->{'target'}->{'maintenanceFlag'};
159
      return "Maintenance Flag found on local machine" if -f $configuration->{'target'}->{'maintenanceFlag'};
Line 270... Line 273...
270
$configuration->{'stats'} = $cwd . "/" . $configuration->{'stats'}
273
$configuration->{'stats'} = $cwd . "/" . $configuration->{'stats'}
271
   if $configuration->{'stats'} && $configuration->{'stats'} !~ m/\//;
274
   if $configuration->{'stats'} && $configuration->{'stats'} !~ m/\//;
272
 
275
 
273
# For each dataset, let's find the snapshots we need
276
# For each dataset, let's find the snapshots we need
274
foreach my $sourceDir ( keys %{$configuration->{'source'}->{'dataset'}} ) {
277
foreach my $sourceDir ( keys %{$configuration->{'source'}->{'dataset'}} ) {
275
   #print "Working on $sourceDir\n";
278
   print "Working on $sourceDir\n" if $configuration->{'testing'};
276
   print "Looking for $sourceDir\n" if $configuration->{'testing'} > 2;
279
   print "Looking for $sourceDir\n" if $configuration->{'testing'} > 2;
277
   print "syncing to $configuration->{target}->{dataset}\n" if $configuration->{'testing'} > 2;
280
   print "syncing to $configuration->{target}->{dataset}\n" if $configuration->{'testing'} > 2;
278
   my $command = $replicateScript . ' ' . join( ' ', @flags ) . ' ' .
281
   my $command = $replicateScript . ' ' . join( ' ', @flags ) . ' ' .
279
                 '--source=' .
282
                 '--source=' .
280
                 $configuration->{'source'}->{'server'} . 
283
                 $configuration->{'source'}->{'server'} . 
281
                 $configuration->{'source'}->{'dataset'}->{$sourceDir} . '/' . $sourceDir . ' ' .
284
                 $configuration->{'source'}->{'dataset'}->{$sourceDir} . '/' . $sourceDir . ' ' .
282
                 '--target=' .
285
                 '--target=' .
283
                 $configuration->{'target'}->{'server'} . 
286
                 $configuration->{'target'}->{'server'} . 
284
                 $configuration->{'target'}->{'dataset'} . '/' . $sourceDir;
287
                 $configuration->{'target'}->{'dataset'} . '/' . $sourceDir;
285
   #print "Command is $command\n";
288
   print "Command is $command\n" if $configuration->{'testing'};
286
   push @status, &currentTime() . " Running $command" if $configuration->{'verbose'} > 1;
289
   push @status, &currentTime() . " Running $command" if $configuration->{'verbose'} > 1;
287
   if ( ! $configuration->{'testing'} ) {
290
   if ( ! $configuration->{'testing'} ) {
288
      ($error, $output) = &runCommand( $command );
291
      ($error, $output) = &runCommand( $command );
289
      push @status, "Dataset\t$sourceDir\n$output";
292
      push @status, "Dataset\t$sourceDir\n$output";
290
      # update stats file if they have requested it
293
      # update stats file if they have requested it