Diff for /loncom/loncron between versions 1.21 and 1.22

version 1.21, 2001/04/24 15:55:13 version 1.22, 2001/08/27 13:54:50
Line 11 Line 11
 # 2/8 Gerd Kortemeyer  # 2/8 Gerd Kortemeyer
 # 12/6/2000,12/8 Scott Harrison  # 12/6/2000,12/8 Scott Harrison
 # 12/23 Gerd Kortemeyer  # 12/23 Gerd Kortemeyer
 # 1/10/2001, 2/12/, 2/26, 3/15, 04/11, 04/21 Scott Harrison  # YEAR=2001
   # 1/10/2001, 2/12/, 2/26, 3/15, 04/11, 04/21,8/27 Scott Harrison
   
 use IO::File;  use IO::File;
 use IO::Socket;  use IO::Socket;
Line 283  print $fh "</pre>"; Line 284  print $fh "</pre>";
   
   
 # ---------------------------------------------------------------------- lonsql  # ---------------------------------------------------------------------- lonsql
 #  
 # Do not run for now  my $restartflag=1;
 #  
 if ($perlvar{'lonRole'} eq "library") {  if ($perlvar{'lonRole'} eq "library") {
   
     print $fh '<hr><a name="lonsql"><h2>lonsql</h2><h3>Log</h3><pre>';      print $fh '<hr><a name="lonsql"><h2>lonsql</h2><h3>Log</h3><pre>';
Line 310  if ($perlvar{'lonRole'} eq "library") { Line 310  if ($perlvar{'lonRole'} eq "library") {
  chomp($lonsqlpid);   chomp($lonsqlpid);
  if (kill 0 => $lonsqlpid) {   if (kill 0 => $lonsqlpid) {
     print $fh "<h3>lonsql at pid $lonsqlpid responding</h3>";      print $fh "<h3>lonsql at pid $lonsqlpid responding</h3>";
       $restartflag=0;
  } else {   } else {
     $errors++; $errors++;      $errors++; $errors++;
     print $fh "<h3>lonsql at pid $lonsqlpid not responding</h3>";      print $fh "<h3>lonsql at pid $lonsqlpid not responding</h3>";
       # Intelligently handle this.
       # Possibility #1: there is no process
       # Solution: remove .pid file and restart
       if (getpgrp($lonsqlpid)==-1) {
    unlink($lonsqlfile);
    $restartflag=1;
       }
       else {
    # Possibility #2: there is a live process that is not
    # responding for an unknown reason
    # Solution: kill parent and children processes, remove .pid
    # and restart
    `killall -9 lonsql`;
    unlink($lonsqlfile);
    $restartflag=1;
       }
  }   }
     } else {   print $fh 
       "<h3>Deciding to clean up stale .pid file and restart lonsql</h3>";
       }
       if ($restartflag==1) {
  $errors++;   $errors++;
  print $fh "<h3>lonsql not running, trying to start</h3>";   print $fh "<h3>lonsql not running, trying to start</h3>";
  system(   system(
Line 387  print $fh "</pre>"; Line 407  print $fh "</pre>";
   
 my $londfile="$perlvar{'lonDaemons'}/logs/lond.pid";  my $londfile="$perlvar{'lonDaemons'}/logs/lond.pid";
   
 my $restartflag=1;  $restartflag=1;
 if (-e $londfile) {      if (-e $londfile) {    
    my $lfh=IO::File->new("$londfile");     my $lfh=IO::File->new("$londfile");
    my $londpid=<$lfh>;     my $londpid=<$lfh>;

Removed from v.1.21  
changed lines
  Added in v.1.22


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>