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

raeburn lon-capa-cvs@mail.lon-capa.org
Wed, 26 May 2004 19:07:11 -0000


raeburn		Wed May 26 15:07:11 2004 EDT

  Added files:                 
    /modules/raeburn	KeepAlive.pl 
  Log:
  Run this from cron (owned by www) to prevent a firewall tearing down inactive TCP/IP connections between LON-CAPA servers.
  
  

Index: modules/raeburn/KeepAlive.pl
+++ modules/raeburn/KeepAlive.pl
#!/usr/bin/perl
  use strict;
  use lib '/home/httpd/lib/perl';
  use LONCAPA::Configuration;
  use Apache::lonnet;
  my %hostname = ();
  my $perlvarref = LONCAPA::Configuration::read_conf('loncapa.conf');
  open(my $config,"<$$perlvarref{'lonTabDir'}/hosts.tab");
  while (my $configline=<$config>) {
      next if ($configline =~ /^(\#|\s*$)/);
      chomp($configline);
      my ($id,$domain,$role,$name,$ip,$domdescr)=split(/:/,$configline);
      if ($id && $domain && $role && $name && $ip) {
          $hostname{$id}=$name;
      } 
  }
  close($config);
  foreach (keys %hostname) {
      my $pingreply = &Apache::lonnet::reply('ping',$_);
      my $pongreply = &Apache::lonnet::reply('pong',$_);
  }