[LON-CAPA-cvs] cvs: modules /raeburn neutrinoharvest.pl

raeburn raeburn@source.lon-capa.org
Mon, 18 Oct 2010 04:04:22 -0000


raeburn		Mon Oct 18 04:04:22 2010 EDT

  Modified files:              
    /modules/raeburn	neutrinoharvest.pl 
  Log:
  - print usage message to log and close filehandle if early exit.
  - print to screen courseID for next course to be checked.
  
  
Index: modules/raeburn/neutrinoharvest.pl
diff -u modules/raeburn/neutrinoharvest.pl:1.3 modules/raeburn/neutrinoharvest.pl:1.4
--- modules/raeburn/neutrinoharvest.pl:1.3	Mon Oct 18 01:43:08 2010
+++ modules/raeburn/neutrinoharvest.pl	Mon Oct 18 04:04:22 2010
@@ -30,10 +30,6 @@
     exit 1;
 }
 
-# Let people know we are running
-open(my $fh,'>>'.$Apache::lonnet::perlvar{'lonDaemons'}.'/logs/neutrinocheck.log');
-print $fh "==== neutrinoharvest.pl Run ".localtime()."====\n";
-
 my @domains = sort(&Apache::lonnet::current_machine_domains());
 my @ids=&Apache::lonnet::current_machine_ids();
 my @okcourses;
@@ -41,6 +37,9 @@
 
 $env{'allowed.bre'} = 'F';
 
+open(my $fh,'>>'.$Apache::lonnet::perlvar{'lonDaemons'}.'/logs/neutrinocheck.log');
+print $fh "==== neutrinoharvest.pl Run ".localtime()."====\n";
+
 my $hasdelta = 0;
 my $now = time;
 my $students;
@@ -77,13 +76,19 @@
         }
     }
 } else {
-    print("Usage: neutrinoharvest.pl <Seconds since last access to filter courses|course_ids e.g., sfu_5H34111eaeeee4b95sful1 sfu_1J125875c1efa4b46sful1>\n");
+
+    my $errormsg = "Usage: neutrinoharvest.pl <Seconds since last access to filter courses|course_ids e.g., sfu_5H34111eaeeee4b95sful1 sfu_1J125875c1efa4b46sful1>\n";
+    print $errormsg;
+    print $fh $errormsg;
     delete($env{'allowed.bre'});
+    print $fh "==== neutrinoharvest.pl completed ".localtime()." ====\n";
+    close($fh);
     exit;
 }
 
 if (@okcourses) {
     foreach my $cid (@okcourses) {
+        print STDOUT "Checking for $cid ...\n";
         &log_neutrinos($cid,$fh,$students);
     }
 } else {