#!/usr/bin/perl $scriptName = ''; $logFileName = ''; $numberOfSteps = ''; $restart = 'Y'; @step = (); $error = 0; foreach $_ (@configFile) { next if ($_ =~ /^\s*$/); next if ($_ =~ /^\s*#/); chop(); if ($_ =~ /^\s*ScriptName:\s+\S+\s*$/) { ($tag,$scriptName) = split(); } elsif ($_ =~ /^\s*LogFileName:\s+\S+\s*$/) { ($tag,$logFileName) = split(); } elsif ($_ =~ /^\s*NumberOfSteps:\s+[0-9]+\s*$/) { ($tag,$numberOfSteps) = split(); } elsif ($_ =~ /\s*Restart:\s+\S+\s*$/) { ($tag,$restart) = split(); } elsif ($_ =~ /^\s*Step\s+[0-9]:/) { $stepNum = $_; $stepNum =~ s/^\s*Step\s+([0-9]+):.*$/$1/; $command = $_; $command =~ s/^\s*Step [0-9]:+\s+//; $step[$stepNum] = $command; } else { print STDERR "Error: unknown config file line:\n"; print STDERR " $_\n"; $error = 1; } } for ($i=1;$i<=$numberOfSteps;$i++) { print "$i: $step[$i]\n"; $ret = system($step[$i]); if ($ret) { print STDERR "\nError: last step failed.\n"; exit(1); } }