Subversion Repositories zfs_utils

Rev

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

Rev 8 Rev 9
Line 40... Line 40...
40
      $return{'dataset'} = $server;
40
      $return{'dataset'} = $server;
41
   }
41
   }
42
   return \%return;
42
   return \%return;
43
}
43
}
44
 
44
 
-
 
45
sub logit {
-
 
46
   open LOG, ">>/tmp/replicate.log" or die "Could not open replicate.log: $!\n";
-
 
47
   print LOG join( "\n", @_ ) .  "\n";
-
 
48
   close LOG;
-
 
49
}
-
 
50
 
45
# runs a command, redirecting stderr to stdout (which it ignores)
51
# runs a command, redirecting stderr to stdout (which it ignores)
46
# then returns 0 and $output on success.
52
# then returns 0 and $output on success.
47
# if error, returns error code and string describing error
53
# if error, returns error code and string describing error
48
sub run {
54
sub run {
49
   my $command = shift;
55
   my $command = shift;
-
 
56
   #&logit( $command );
50
   my $output = qx/$command 2>&1/;
57
   my $output = qx/$command 2>&1/;
51
   if ($? == -1) {
58
   if ($? == -1) {
52
      return (-1,"failed to execute: $!");
59
      return (-1,"failed to execute: $!");
53
   } elsif ($? & 127) {
60
   } elsif ($? & 127) {
54
      return ($?, sprintf "child died with signal %d, %s coredump",
61
      return ($?, sprintf "child died with signal %d, %s coredump",