This script supposedly parses out a backup log, yet I cannot get it to return anything but " the process cannot access the file because it is in use by another process." I received the script from the vendor and have given it my best shot to massage it for win32. The target server is win2k. Directory structure is: ->root -->backex -->bin -->logs
=====Script====== # ====================================================================== # # Perl Source File -- Created with SAPIEN Technologies PrimalSCRIPT(TM) # # NAME: jobreport # # AUTHOR: Mike Singleton , Davita Inc # DATE : 7/3/2002 # # PURPOSE: SyncSort Reporting # # ====================================================================== ########################################################################### # # my $HELP=" <description>: This script must be run on the Backup Express master server. This script must be run from the bin subdirectory of Backup Express if the environment variable SSPRODIR is not set to the Backup Express directory. You must have admin priviliges to run this script. \"jobrpt\" will generate a report of completed and failed Backup Express jobs, based on the information in the logs subdirectory. Note that this is not identical to the information contained in the Backup Express catalog. In particular, it only provides information on the last 30 days worth of jobs. <options>: -h : Help. USAGE; \"$0 \" Type \"$0 -h\" for help "; # <dependencies>: # None. # # <outputs>: # This script uses a temporary file $SSPRODIR/bin/jobrpt.tmp # The report is written to standard output ########################################################################### # Initialization ########################################################################### # load modules use strict; use English; use Getopt::Std; use Cwd; # Set defaults my $CUR_DIR=cwd; my $SSPRODIR=$ENV{SSPRODIR}; # Check for $SSPRODIR. #if ("$SSPRODIR" eq "") { # if (! -x "$CUR_DIR\/ssbrowse") { # die "$0: ERRPR: You must either set SSPRODIR or run this script from Backup Express bin directory.\n\n$HELP"; # } # chdir '..'; # $SSPRODIR=cwd; # chdir $CUR_DIR; #} #my $RPTFILE="$SSPRODIR/bin/jobrpt.tmp"; my $RPTFILE="jobrpt.tmp"; ########################################################################### # Parse arguments ########################################################################### getopts('hn:p:o:s:') or die "$HELP"; ($Getopt::Std::opt_h) and die $HELP; my $JOB_NAME=""; if (@ARGV) { $JOB_NAME=shift @ARGV; } (@ARGV==0) or die "$0: ERROR: Too many arguments on the command line.\n"; # Get a temporary file id my $COUNT=0; #my $OUT_TEMP="$SSPRODIR/jobrpt.$COUNT"; my $OUT_TEMP="jobrpt.$COUNT"; my ($njob, @line, $current); my (@jobid, %starttime, %jobname, %jobtype, %status, %endtime, %volser); my $grepexpr; format = @<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $jobname{$_}, $jobtype{$_}, $starttime{$_}, $endtime{$_}, $volser{$_} . #grep all the job logs for the following codes: # Job start my $JOBSTART = 'SNBJH_3203J'; # Condense start my $CONDSTART = 'SNBJH_3403'; # Job end my $JOBEND = 'SNBJH_3211J'; # Condense end my $CONDEND = 'SNBJH_3401J'; # Job cancelled my $JOBCANC = 'SNBJH_3258J'; # Job fail my $JOBFAIL = '-1'; # Volsers used my $VOLUSED = 'SNBJH_3320J'; my %statcode = ( "$JOBEND" => '0', "$CONDEND" => '0', "$JOBFAIL" => '-1', "$JOBCANC" => '-2', ); my $MAXVLENGTH = 30; my $search; while (-f $OUT_TEMP) { $COUNT += 1; #$OUT_TEMP="$SSPRODIR/jobrpt.$COUNT"; $OUT_TEMP="jobrpt.$COUNT"; } # Open the temp file for write # Check to make sure that job exists open (OUTF,">$OUT_TEMP") || die "Cannot open output file $!"; $grepexpr = "egrep \"$JOBSTART\|$CONDSTART\|$JOBEND\|$CONDEND\|$JOBCANC\|$VOLUSED\" \` ls -tr ../logs/3*.log\` >$OUT_TEMP"; system "$grepexpr"; close OUTF; $njob = 0; # Open the temp file for read open (OUTF,"$OUT_TEMP") || die "Cannot open file for read, $!"; while (<OUTF>) { @line = split(' '); # First the grep for the start of the job # print "Seventh token is $line[7]\n"; $search = '$line[7] =~ /' . "$JOBSTART" . '/'; if (eval $search) { chop $line[14]; # Remove the ")" $current = $line[14]; $jobid[$njob++] = $current; $starttime{$current} = $line[2] . " "; $starttime{$current} .= $line[3] . " "; $starttime{$current} .= $line[4] . " "; $starttime{$current} .= $line[5] . " "; $starttime{$current} .= $line[6]; $jobname{$current} = $line[11]; $jobtype{$current} = $line[17]; chop $jobtype{$current}; $status{$current} = $statcode{$JOBFAIL}; # Default $endtime{$current} .= $starttime{$current}; # Default $volser{$current} = ''; } $search = '$line[7] =~ /' . "$CONDSTART" . '/'; if (eval $search) { chop $line[15]; # Remove the ")" $current = $line[15]; $jobid[$njob++] = $current; $starttime{$current} = $line[2] . " "; $starttime{$current} .= $line[3] . " "; $starttime{$current} .= $line[4] . " "; $starttime{$current} .= $line[5] . " "; $starttime{$current} .= $line[6]; $jobname{$current} = $line[10]; $jobtype{$current} = $line[10]; $status{$current} = $statcode{$JOBFAIL}; # Default $endtime{$current} .= $starttime{$current}; # Default $volser{$current} = ''; # No volsers for Condense } $search = '$line[7] =~ /' . "$JOBEND" . '/'; if (eval $search) { # First check whether the bytecount is nonzero if ($line[17] ne '0') { $status{$current} = $statcode{$JOBEND}; } else { $status{$current} = $statcode{$JOBFAIL}; }; $endtime{$current} = $line[2] . " "; $endtime{$current} .= $line[3] . " "; $endtime{$current} .= $line[4] . " "; $endtime{$current} .= $line[5] . " "; $endtime{$current} .= $line[6]; } $search = '$line[7] =~ /' . "$CONDEND" . '/'; if (eval $search) { $status{$current} = $statcode{$CONDEND}; } $search = '$line[7] =~ /' . "$JOBCANC" . '/'; if (eval $search) { $status{$current} = $statcode{$JOBCANC}; } $search = '$line[7] =~ /' . "$VOLUSED" . '/'; if (eval $search) { # print "Line contains token 7 $line[7].\n"; $search = '$volser{$current} =~ /' . "$line[9]" . '/'; if (!(eval $search)) { $volser{$current} .= ' ' . $line[9] . '(' . $line[11] . ')'; } } }; # Now print out the hashed data print " * * * * * "; print "Completed jobs"; print " * * * * * \n"; print "Jobname Type Start End Volsers(Partitions)\n"; foreach (@jobid) { if ($status{$_} eq $statcode{$JOBEND}) { if (length $volser{$_} > $MAXVLENGTH) { $volser{$_} = 'See job log'; } write; }; } print "\n\n * * * * * "; print "Cancelled jobs"; print " * * * * * \n"; print "Jobname Type Start End\n"; foreach (@jobid) { if ($status{$_} eq $statcode{$JOBCANC}) { write; }; } print "\n\n * * * * * "; print "Failed jobs"; print " * * * * * \n"; print "Jobname Type Start End\n"; foreach (@jobid) { if ($status{$_} eq $statcode{$JOBFAIL}) { write; }; } exit 0; === Mike Singleton Network Analyst (253) 272-1916 x1259 (253) 405-1968 (cellular) [EMAIL PROTECTED] DaVita Inc. _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs