Subversion Repositories sysadmin_scripts

Rev

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

Rev 169 Rev 170
Line 8... Line 8...
8
my $source = shift;
8
my $source = shift;
9
my $target = shift;
9
my $target = shift;
10
 
10
 
11
die "Usage: replicate source target\n" unless $source && $target;
11
die "Usage: replicate source target\n" unless $source && $target;
12
 
12
 
-
 
13
my $dryRun = 0; # if set, will only display the command to be executed
-
 
14
 
13
my $config = {
15
my $config = {
14
   # compile the regex
16
   # compile the regex
15
   'pattern' => qr/auto-\d{4}-\d{2}-\d{2}_\d{2}-\d{2}/
17
   'pattern' => qr/auto-\d{4}-\d{2}-\d{2}_\d{2}-\d{2}/
16
   };
18
   };
17
 
19
 
Line 201... Line 203...
201
#print Dumper( $config ); die;
203
#print Dumper( $config ); die;
202
 
204
 
203
my $commands = &createCommands( $config );
205
my $commands = &createCommands( $config );
204
for ( my $i = 0; $i < @{$commands}; $i++ ) {
206
for ( my $i = 0; $i < @{$commands}; $i++ ) {
205
   print "$$commands[$i]\n";
207
   print "$$commands[$i]\n";
-
 
208
   if ( $dryRun ) {
-
 
209
      print "Dry Run\n";
-
 
210
   } else {
206
   print qx/$$commands[$i]/ if $$commands[$i] =~ m/^[a-zA-Z]/;
211
      print qx/$$commands[$i]/ if $$commands[$i] =~ m/^[a-zA-Z]/;
-
 
212
   }
207
}
213
}
208
 
214
 
209
#print Dumper( $config );
215
#print Dumper( $config );
210
 
216
 
211
1;
217
1;
212
 
218