Subversion Repositories sysadmin_scripts

Rev

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

Rev 98 Rev 99
Line 205... Line 205...
205
}   
205
}   
206
 
206
 
207
sub run {
207
sub run {
208
   my $testing = shift;
208
   my $testing = shift;
209
   # bail if there are no commands to run
209
   # bail if there are no commands to run
210
   return 1 unless @_;
210
   return 0 unless @_;
211
   if ( $testing ) { # don't do it, just dump the commands
211
   if ( $testing ) { # don't do it, just dump the commands
212
      open LOG, ">/tmp/snapShot" or die "could not write to /tmp/snapShot: $!\n";
212
      open LOG, ">/tmp/snapShot" or die "could not write to /tmp/snapShot: $!\n";
213
      print LOG join( "\n", @_ ) . "\n";
213
      print LOG join( "\n", @_ ) . "\n";
214
      close LOG;
214
      close LOG;
215
   } else {
215
   } else {
Line 232... Line 232...
232
      }
232
      }
233
   }
233
   }
234
   return 0;
234
   return 0;
235
}
235
}
236
 
236
 
237
&readConfig();
237
&readConfig() or die "Could not read config file: $!\n";
238
 
238
 
239
# grab the time once
239
# grab the time once
240
my $now = time;
240
my $now = time;
241
# create the string to be used for all snapshots, using $now and the template provided
241
# create the string to be used for all snapshots, using $now and the template provided
242
my $snapshotName = '@' . strftime($config->{'snapshot'}->{'template'},localtime $now);
242
my $snapshotName = '@' . strftime($config->{'snapshot'}->{'template'},localtime $now);
Line 255... Line 255...
255
&parseSnapshots($snapshots, $config );
255
&parseSnapshots($snapshots, $config );
256
# mergeData the snapshots into the datasets for convenience
256
# mergeData the snapshots into the datasets for convenience
257
&mergeData( $dataSets, $snapshots, $config );
257
&mergeData( $dataSets, $snapshots, $config );
258
# Now, let's do the actual processing
258
# Now, let's do the actual processing
259
my @commands  = &process( $dataSets, $now, $snapshotName, &period2seconds( $config->{'slop'} ) );
259
my @commands  = &process( $dataSets, $now, $snapshotName, &period2seconds( $config->{'slop'} ) );
-
 
260
#print join ( "\n", @commands ) . "\n";
260
my $errors;
261
my $errors;
261
print $errors if $errors = &run( $config->{'TESTING'}, @commands );
262
print "Error: $errors\n" if $errors = &run( $config->{'TESTING'}, @commands );
262
   
263
   
263
 
264
 
264
#print Dumper( $dataSets );
265
# print Dumper( $dataSets );
265
#print Dumper( $snapshots );
266
#print Dumper( $snapshots );
266
 
267
 
267
#print join ("\n", sort keys( %$dataSets ) ) . "\n\n";
268
#print join ("\n", sort keys( %$dataSets ) ) . "\n\n";
268
#print join( "\n", sort keys( %$snapshots ) ) . "\n";
269
#print join( "\n", sort keys( %$snapshots ) ) . "\n";
269
 
270