No, I don't mind. Here's a stripped down version of the report processor:
#!/usr/bin/perl -w use strict; use warnings; use myUtils; ### # CONFIG ### my %Apps = ( CSV_Reports => { cmdline=>'CSV_reports.pl', ext=>'.csv', inbound=>'/Rpts', outbound=>'/Rpts/CSV' }, Excel_Reports => { cmdline=>'NME_report.pl', ext=>'.nme', inbound=>'/Rpts', outbound=>'/Rpts/XL', }, ); my $DozeTime = 5; #5 * 60; # 5 min my $DieFile = '/var/log/report_processor.halt'; ### # CODE ### open my $LOG, '>>', '/var/log/report_processor.log' or die $!; print $LOG join("\n", box_fixed(80, 'Reports Log', 'Started at: ' . myUtils::timestamp() ), ), "\n\n"; while (! -e $DieFile) { for my $RName (keys %Apps) { chdir $Apps{$RName}{inbound}; my @files = map { s/\s+$//; $_ } # and chomp the names grep { /$Apps{$RName}{ext}$/ } # files for this repo +rt qx( ls -1 --file-type ); # check inbound dir f +or for my $FName (@files) { print $LOG myUtils::timestamp() . ": processing $RName: infil +e $FName\n"; my $curtime = time; system($Apps{$RName}{cmdline}, $FName); $curtime = time - $curtime; print $LOG "\t$curtime secs.\n\n"; print "mv $FName $Apps{$RName}{outbound}/$FName"; rename($FName, "$Apps{$RName}{outbound}/$FName") or die $!; } } sleep $DozeTime; } if (-e $DieFile) { print $LOG "Normal halt at " . myUtils::timestamp() . "\n\n"; unlink $DieFile; } else { print $LOG "*UNEXPECTED HALT: " . myUtils::timestamp() . "\n\n"; }
The basic shell for something that would generate the data file would be like:
#!/usr/bin/perl -w use strict; use warnings; my $FName = '/Rpts/geezer.csv'; open my $OF, '>', "$FName.work" or die $!; print $OF <<JUNK; A bunch of junk to generate a report. JUNK close $OF; rename "$FName.work", $FName;
...roboticus
In reply to Re^4: read directory, fork processes
by roboticus
in thread read directory, fork processes
by KevinBr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |