#!/usr/bin/perl BEGIN{} init(); getExportInfo(); preparePrint(); END{} sub init { $logDir = "/home/drmvar"; $exportFile = "$logDir/EXPORT"; $exportPrt = "$logDir/exportLijst"; $dateTime = localtime(); $countU = 0; $format = "MAGSTAR MP"; $printer = "miami"; $mailAdress = "cs-tsm\@email.nl adres\@email.nl"; } sub getExportInfo { $recNo = 0; open(EXPORT,"< $exportFile"); while(){ ($volSer[$recNo], $state[$recNo], $date[$recNo], $time[$recNo], $lib[$recNo]) = split(); if("chomp($volSer[$recNo])" eq " " || "$volSer[$recNo]" eq "Volume" || "$volSer[$recNo]" eq "Date/Time" || "$volSer[$recNo]" eq "----------------") {next;} ++$recNo; } } sub preparePrint { open(CALLTOTAPES,">$exportPrt"); select(CALLTOTAPES); print "\t\t\t$dateTime\n"; format CALLTOTAPESHEAD= CARTRIDGES VAN DECENTRAAL *** NAAR *** VAN: *** - DECENTRAAL NAAR: *** - KLUIS OBS VOLSER FORMAT DSN --------------------------------------------------------------------- . format CALLTOTAPES= @<<<<<<<<<@<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<@<<<<<@<<<<<<<<<<<<<<<<<<<< $countU, $dsnNo, $format, $dsnNo, $ddd . $~ = CALLTOTAPESHEAD; write; $~ = CALLTOTAPES; $ddd= ".OHRA.tsm"; while ($countU <= $#volSer) { $dsnNo = $volSer[$countU]; write; ++$countU; } close(CALLTOTAPES); select(STDOUT); system("mail -s 'Tapes to be moved out of library lib01' $mailAdress < $exportPrt"); system("lpr -P $printer $exportPrt"); system("rm $exportFile"); }