Changeset 27678 for other-projects
- Timestamp:
- 2013-06-20T21:31:07+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/nightly-tasks/diffcol/trunk/task.pl
r27677 r27678 42 42 43 43 44 $ENV{'BIN_DIR'} = &filename_concat($ENV{'TASK_HOME'}, "bin"); 45 46 # 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 54 $blat = 0; 55 } 56 57 44 58 $ENV{'DATA_DIR'} = &filename_concat($ENV{'TASK_HOME'}, "diffcol-data"); 45 59 $ENV{'UPLOAD_DIR'} = &filename_concat($ENV{'TASK_HOME'}, "diffcol-reports"); 46 60 $ENV{'MONITOR_EMAIL'} = "greenstone_team\@cs.waikato.ac.nz"; # need to escape @ sign 47 $ENV{'GSDL_SMTP'} = ""; 61 $ENV{'GSDL_SMTP'} = ""; #"smtp.gmail.com"; 48 62 ##print STDERR "@@@ email: ".$ENV{'MONITOR_EMAIL'}."\n"; 49 63 … … 568 582 } 569 583 570 #use the 584 #use the correct key for uploading 571 585 $ENV{'IDENTITY_FILE'} = "$ENV{'IDENTITY_DIR'}${sep}upload-" . $ENV{'SNAPSHOT_MODE'} . ($^O eq "MSWin32" ? ".ppk" : ""); 572 586 if(-f $ENV{'IDENTITY_FILE'}) { 587 # if you need to touch the file on windows: http://stackoverflow.com/questions/51435/windows-version-of-the-unix-touch-command 588 573 589 # the report we want to upload is actually just report-$dateid.html 574 590 my $command = "cd \"$ENV{'UPLOAD_DIR'}\" && tar -c *.html | "; #&& cat *.html | "; # && tar -c * | … … 578 594 my $status = system("$command"); 579 595 if($status != 0) { 580 print STDERR "*** Failed to upload test report to nzdl \n";596 print STDERR "*** Failed to upload test report to nzdl $status\n"; 581 597 } 582 598 } else { … … 605 621 my $attach_file = &filename_concat($ENV{'DATA_DIR'}, "report-$dateid.html"); 606 622 607 if($isWin) { 608 # http://stackoverflow.com/questions/709635/sending-mail-from-batch-file 609 #blat -to [email protected] -server smtp.example.com -f [email protected] -subject "subject" -body "body" 610 611 $cmd = "blat -to $ENV{'MONITOR_EMAIL'} -server $ENV{'GSDL_SMTP'} -f $attach_file -subject $subject -body $msg"; # need to install blat on windows 612 613 } else { 623 if($isWin) { 624 if($blat && $ENV{'GSDL_SMTP'}) { 625 # http://stackoverflow.com/questions/709635/sending-mail-from-batch-file 626 #blat -to [email protected] -server smtp.example.com -f [email protected] -subject "subject" -body "body" 627 628 # need to install blat on windows 629 $cmd = "$blat -to $ENV{'MONITOR_EMAIL'} -server $ENV{'GSDL_SMTP'} -f $ENV{'MONITOR_EMAIL'} -attach $attach_file -subject \"$subject\" -body \"$msg\""; 630 $result = system($cmd); 631 } 632 else { 633 $result = 0; 634 print STDERR "********************************************\n"; 635 print STDERR "Need blat and SMTP set to send mail attachment\n"; 636 print STDERR "Inspect report at: $attach_file\n"; 637 print STDERR "********************************************\n"; 638 } 639 } else { # linux 614 640 my $status = system("command -v mutt > /dev/null 2>&1;"); #better way of doing "which mutt" 615 641 … … 625 651 $cmd = "echo '$gsdl regression test for $dateid failed' | mutt -a $attach_file -s 'Regression Test Failed' -- $ENV{'MONITOR_EMAIL'}"; 626 652 } 627 } 628 629 # run the mail command 630 $result = system($cmd); #&run_and_print_cmd($cmd); 653 654 # run the mail command 655 $result = system($cmd); #&run_and_print_cmd($cmd); 656 } 657 658 631 659 if($result != 0) { 632 660 print STDERR "*** Unable to send email: $?\n";
Note:
See TracChangeset
for help on using the changeset viewer.