Changeset 27687 for other-projects/nightly-tasks
- Timestamp:
- 2013-06-21T17:32:41+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/nightly-tasks/diffcol/trunk/task.pl
r27678 r27687 35 35 #my $script_ext = $isWin ? ".bat" : ".bash"; 36 36 my $setup_script = "setup"; # needs to become gs3-setup for GS3 37 my $use_blat = 0; # if we ever get blat to send mail/attachments on Windows working, set this to 1 37 38 38 39 # TASK_HOME should be the toplevel diffcol folder … … 45 46 46 47 # we'll be using BLAT to send mail attachments on Windows 47 my $blat = &filename_concat($ENV{'BIN_DIR'}, "blat", "full", "blat.exe"); 48 if($isWin && ! -e $blat) { 49 print STDERR "*** No blat.exe found in $blat.\n"; 50 print STDERR "*** Blat needed to send mail with attachments on Windows.\n"; 51 print STDERR "*** Extract the blat zip file found in $ENV{'BIN_DIR'}\n"; 52 print STDERR "*** for your bit architecture and name the folder 'blat'\n"; 53 48 my $blat = $use_blat ? &filename_concat($ENV{'BIN_DIR'}, "blat", "full", "blat.exe") : 0; 49 if($isWin && $use_blat && ! -e $blat) { 50 print STDERR "\n***********************************\n"; 51 print STDERR "No blat.exe found in $blat.\n"; 52 print STDERR "Blat needed to send mail with attachments on Windows.\n"; 53 print STDERR "Extract the blat zip file found in $ENV{'BIN_DIR'}\n"; 54 print STDERR "for your bit architecture and name the folder 'blat'\n"; 55 print STDERR "***********************************\n\n"; 54 56 $blat = 0; 55 57 } … … 390 392 print STDERR "$collection - Importing:\n"; 391 393 print $xml_fh "<import>\n"; 392 &run_build_script("import.pl -OIDtype hash_on_full_filename $collection -removeold");394 &run_build_script("import.pl $collection -removeold"); #-OIDtype hash_on_full_filename 393 395 print $xml_fh "</import>\n"; 394 396 print STDERR "done\n"; … … 450 452 451 453 # chdir($greenstone_home); 452 453 # we are in $greenstone_home, can directly run the build cmd on the collection 454 # we are in $greenstone_home already, can directly run the build cmd on the collection 454 455 if(!$isWin) { 455 456 $cmd = "bash -c \"export GSDLHOME=&& source $setup_script.bash && $cmd\""; … … 457 458 } else { # Need to prefix cmd -c/-k as necessary 458 459 $cmd = "cmd /c \"set GSDLHOME=&& $setup_script.bat && perl -S $cmd\""; 459 ## print STDERR "@@@@ Going to call command: $cmd\n"; 460 461 } 460 } 461 ## print STDERR "@@@@ Going to call command: $cmd\n"; 462 462 463 463 return system($cmd); … … 565 565 opendir my($dh), $ENV{'DATA_DIR'} or die "Could not open DATA_DIR: $!"; 566 566 for my $entry (readdir $dh) { 567 next if ($entry !~ m/(\.xml|\.html)$/); 568 # get the absolute path to the files before copying them over 569 $entry = &filename_concat($ENV{'DATA_DIR'}, $entry); 570 copy($entry, $ENV{'UPLOAD_DIR'}); 567 next if ($entry !~ m/(\.xml|\.html?)$/); 568 569 # copy the reports across with different names: with OS prefixed to them. And for the HTML file on Win, rename to HTM 570 # html files uploaded from windows to nzdl are empty for no reason. Uploading as htm seems to work 571 my $os = $^O; 572 (my $os_entry = $entry) =~ s@\[email protected]@ if $isWin; 573 $os_entry = $^O."-$os_entry"; 574 575 # get the absolute path to the original files before copying them over 576 $entry = &filename_concat($ENV{'DATA_DIR'}, $entry); 577 578 # copy them over with their new names 579 ## print STDERR "@@@@ copying across $entry to $ENV{'UPLOAD_DIR'} as $os_entry\n"; 580 copy($entry, "$ENV{'UPLOAD_DIR'}$sep$os_entry"); #copy($entry, "$ENV{'UPLOAD_DIR'}"); 571 581 } 572 582 closedir $dh; … … 588 598 589 599 # the report we want to upload is actually just report-$dateid.html 590 my $command = "cd \"$ENV{'UPLOAD_DIR'}\" && tar -c *.htm l| "; #&& cat *.html | "; # && tar -c * |600 my $command = "cd \"$ENV{'UPLOAD_DIR'}\" && tar -c *.htm* | "; #&& cat *.html | "; # && tar -c * | 591 601 $command .= ($^O eq "MSWin32" ? "plink" : "ssh"); 592 602 $command .= " -T -i \"$ENV{'IDENTITY_FILE'}\" nzdl\@puka.cs.waikato.ac.nz"; … … 621 631 my $attach_file = &filename_concat($ENV{'DATA_DIR'}, "report-$dateid.html"); 622 632 623 if($isWin) { 624 if($ blat && $ENV{'GSDL_SMTP'}) {633 if($isWin) { 634 if($use_blat && $blat && $ENV{'GSDL_SMTP'}) { 625 635 # http://stackoverflow.com/questions/709635/sending-mail-from-batch-file 626 636 #blat -to [email protected] -server smtp.example.com -f [email protected] -subject "subject" -body "body" … … 631 641 } 632 642 else { 633 $result = 0;643 $result = 1; # status from running mail command is 0 if success, 1 if fail 634 644 print STDERR "********************************************\n"; 635 print STDERR "Need blat and SMTP set to send mail attachment\n"; 645 if ($use_blat) { 646 print STDERR "Need blat and SMTP set to send mail attachment\n" ; 647 } else { 648 print STDERR "Not set up to send mail on Windows\n"; 649 } 636 650 print STDERR "Inspect report at: $attach_file\n"; 637 651 print STDERR "********************************************\n";
Note:
See TracChangeset
for help on using the changeset viewer.