Subversion Repositories zfs_utils

Rev

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

Rev 16 Rev 18
Line 180... Line 180...
180
      my $bytes = $1;
180
      my $bytes = $1;
181
      open STATS,">>$filename" or warn "Could not create file $filename: $!\n";
181
      open STATS,">>$filename" or warn "Could not create file $filename: $!\n";
182
      print STATS &currentTime('') . "\t$label\t$seconds\t$bytes\n";
182
      print STATS &currentTime('') . "\t$label\t$seconds\t$bytes\n";
183
      close STATS
183
      close STATS
184
   } else {
184
   } else {
185
      warn "updateStats called with invalid report\n";
185
      warn "updateStats called with invalid report\n" if $configuration->{'verbose'}>1;
186
   }
186
   }
187
}
187
}
188
 
188
 
189
my @status;   
189
my @status;   
190
my $error = 0;
190
my $error = 0;
Line 195... Line 195...
195
# die Dumper( $configuration ) . "\n";
195
# die Dumper( $configuration ) . "\n";
196
 
196
 
197
my $servername = `hostname`;
197
my $servername = `hostname`;
198
chomp $servername;
198
chomp $servername;
199
 
199
 
-
 
200
if ( $configuration->{'verbose'} > 1 ) {
200
push @status, "Replication on $servername has been started at " . &currentTime();
201
   push @status, "Replication on $servername has been started at " . &currentTime();
201
&sendMail( "Replication on $servername has been started, " . &currentTime(), $configuration, "Replication on $servername started" );
202
   &sendMail( "Replication on $servername has been started, " . &currentTime(), $configuration, "Replication on $servername started" );
-
 
203
}
202
 
204
 
203
# see if remote machine is up by sending one ping. Expect response in 5 seconds
205
# see if remote machine is up by sending one ping. Expect response in 5 seconds
204
( $error,$output) = &checkRemoteUp( $configuration );
206
( $error,$output) = &checkRemoteUp( $configuration );
205
$configuration->{'up'} = ! $error;
207
$configuration->{'up'} = ! $error;
206
push @status, "remote machine is " . ( $configuration->{'up'} ? 'Up' : 'Down' ) . "\n";
208
push @status, "remote machine is " . ( $configuration->{'up'} ? 'Up' : 'Down' ) . "\n";
Line 224... Line 226...
224
   &sendMail( join( "\n", @status ), $configuration, "Mount Drive Error: [$output]" );
226
   &sendMail( join( "\n", @status ), $configuration, "Mount Drive Error: [$output]" );
225
   &shutdownMachine( $configuration );
227
   &shutdownMachine( $configuration );
226
}
228
}
227
 
229
 
228
#&sendMail( "Backup has been started at " . &currentTime(), $configuration, "Backup Starting" );
230
#&sendMail( "Backup has been started at " . &currentTime(), $configuration, "Backup Starting" );
229
push @status, &currentTime() . ' Backup started';
231
push @status, &currentTime() . ' Backup started' if $configuration->{'verbose'};
230
 
232
 
231
$configuration->{'source'}->{'server'} = $configuration->{'source'}->{'server'} ? $configuration->{'source'}->{'server'} . ':' : '';
233
$configuration->{'source'}->{'server'} = $configuration->{'source'}->{'server'} ? $configuration->{'source'}->{'server'} . ':' : '';
232
$configuration->{'target'}->{'server'} = $configuration->{'target'}->{'server'} ? $configuration->{'target'}->{'server'} . ':' : '';
234
$configuration->{'target'}->{'server'} = $configuration->{'target'}->{'server'} ? $configuration->{'target'}->{'server'} . ':' : '';
233
 
235
 
234
my @flags;
236
my @flags;
Line 255... Line 257...
255
                 $configuration->{'source'}->{'dataset'}->{$sourceDir} . '/' . $sourceDir . ' ' .
257
                 $configuration->{'source'}->{'dataset'}->{$sourceDir} . '/' . $sourceDir . ' ' .
256
                 '--target=' .
258
                 '--target=' .
257
                 $configuration->{'target'}->{'server'} . 
259
                 $configuration->{'target'}->{'server'} . 
258
                 $configuration->{'target'}->{'dataset'} . '/' . $sourceDir;
260
                 $configuration->{'target'}->{'dataset'} . '/' . $sourceDir;
259
   #print "Command is $command\n";
261
   #print "Command is $command\n";
260
   push @status, &currentTime() . " Running $command";
262
   push @status, &currentTime() . " Running $command" if $configuration->{'verbose'} > 1;
261
   if ( ! $configuration->{'testing'} ) {
263
   if ( ! $configuration->{'testing'} ) {
262
      ($error, $output) = &runCommand( $command );
264
      ($error, $output) = &runCommand( $command );
263
      push @status, "Dataset\t$sourceDir\n$output";
265
      push @status, "Dataset\t$sourceDir\n$output";
264
      # update stats file if they have requested it
266
      # update stats file if they have requested it
265
      &updateStats( $sourceDir, $configuration->{'stats'}, $output ) if $configuration->{'stats'};
267
      &updateStats( $sourceDir, $configuration->{'stats'}, $output ) if $configuration->{'stats'};
266
   }
268
   }
267
   push @status, &currentTime() . " Completed command, with status $error";
269
   push @status, &currentTime() . " Completed command, with status $error" if $configuration->{'verbose'} > 1;;
268
}
270
}
269
 
271
 
270
#print "Finished processing\n";
272
#print "Finished processing\n";
271
#print "testing is " . $configuration->{'testing'} . "\n";
273
#print "testing is " . $configuration->{'testing'} . "\n";
272
 
274