use strict; use warnings; use POSIX; # specify location my $LOG_DIR = "E:/perl"; # declare variables my $scheduler = "e:/perl/schedule.csv"; my $now = localtime time; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); my $datestamp = sprintf("%04d%02d%02d_%02d%02d", $year+1900, $mon+1, $mday, $hour, $min); my $report_line = ""; open (OUT, ">E:/perl/scheduler_check.txt") or die $!; print OUT "Report started: ", $now, "\n"; print OUT "\n"; open FILE, "$scheduler" or die $!; while () { my $line = $_; my @fields = split(/\",\"/,$line); if ($fields[2] =~ /Disabled/ || $fields[2] =~ /"Could not start"/ || $fields[2] =~ /Running/ || $fields[2] =~ /Skipped/ ) { $report_line .= $fields[1]. "\t".$fields[2]."\t".$fields[3]."\n";; } } close FILE or die; if ($report_line ne "") { print OUT "TaskName Next Run Time Status\n"; print OUT "=============================== ======================== ===============\n"; print OUT $report_line; } if ($report_line eq "") { print OUT "\t \n"; } $now = localtime time; print OUT "\n","Report finished: ", $now; close OUT or die; exit;