[LON-CAPA-cvs] cvs: loncom / htpasswd loncapa_apache.conf /cgi takeoffline.pl takeonline.pl doc/loncapafiles loncapafiles.lpml

www lon-capa-cvs@mail.lon-capa.org
Thu, 11 Sep 2003 19:47:30 -0000


www		Thu Sep 11 15:47:30 2003 EDT

  Added files:                 
    /loncom/cgi	takeoffline.pl takeonline.pl 

  Modified files:              
    /doc/loncapafiles	loncapafiles.lpml 
    /loncom	htpasswd loncapa_apache.conf 
  Log:
  Script to re-route traffic from one LON-CAPA server to another in case of
  weirdness.
  
  Use:
  
   /cgi-bin/takeoffline.pl
  
  puts up screen that server is kaputt
  
   /cgi-bin/takeoffline.pl?foo.bar.edu
  
  reroute to foo.bar.edu
  
   /cgi-bin/takeonline.pl
  
  restore normal welcome
  
  Uses basic auth user "offline"
  
  
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.279 doc/loncapafiles/loncapafiles.lpml:1.280
--- doc/loncapafiles/loncapafiles.lpml:1.279	Tue Sep  2 15:35:08 2003
+++ doc/loncapafiles/loncapafiles.lpml	Thu Sep 11 15:47:30 2003
@@ -2,7 +2,7 @@
  "http://lpml.sourceforge.net/DTD/lpml.dtd">
 <!-- loncapafiles.lpml -->
 
-<!-- $Id: loncapafiles.lpml,v 1.279 2003/09/02 19:35:08 matthew Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.280 2003/09/11 19:47:30 www Exp $ -->
 
 <!--
 
@@ -838,6 +838,22 @@
 </description>
 </file>
 <file>
+<source>loncom/cgi/takeoffline.pl</source>
+<target dist='default'>home/httpd/cgi-bin/takeoffline.pl</target>
+<categoryname>script</categoryname>
+<description>
+Take machine offline
+</description>
+</file>
+<file>
+<source>loncom/cgi/takeonline.pl</source>
+<target dist='default'>home/httpd/cgi-bin/takeonline.pl</target>
+<categoryname>script</categoryname>
+<description>
+Take machine online
+</description>
+</file>
+<file>
 <source>loncom/cgi/thumbnail.gif</source>
 <target dist='default'>home/httpd/cgi-bin/thumbnail.gif</target>
 <categoryname>script</categoryname>
@@ -1146,7 +1162,7 @@
 <file>
 <source>loncom/htpasswd</source>
 <target dist='default'>home/httpd/lonTabs/htpasswd</target>
-<categoryname>conf</categoryname>
+<categoryname>static conf</categoryname>
 <description>
 Basic auth password to access /lon-status and /server-status
 </description>
@@ -3630,6 +3646,12 @@
 <target dist='default'>home/httpd/html/index.html</target>
 <categoryname>interface file</categoryname>
 <description>bumps to login</description>
+</file>
+<file>
+<source>loncom/html/index.html</source>
+<target dist='default'>home/httpd/html/origindex.html</target>
+<categoryname>interface file</categoryname>
+<description>bumps to login, backup for takeonline</description>
 </file>
 <file>
 <source>loncom/html/favicon.ico</source>
Index: loncom/htpasswd
diff -u loncom/htpasswd:1.2 loncom/htpasswd:1.3
--- loncom/htpasswd:1.2	Fri Oct 25 10:03:58 2002
+++ loncom/htpasswd	Thu Sep 11 15:47:30 2003
@@ -1,2 +1,3 @@
 lonadm:oeRooOvb3HtpI
 reaper:4KAgvcAEZYiHE
+offline:AkFM3kQlEL9.2
Index: loncom/loncapa_apache.conf
diff -u loncom/loncapa_apache.conf:1.61 loncom/loncapa_apache.conf:1.62
--- loncom/loncapa_apache.conf:1.61	Thu Sep 11 14:21:46 2003
+++ loncom/loncapa_apache.conf	Thu Sep 11 15:47:30 2003
@@ -1,7 +1,7 @@
 ##
 ## loncapa_apache.conf -- Apache HTTP LON-CAPA configuration file
 ##
-## $Id: loncapa_apache.conf,v 1.61 2003/09/11 18:21:46 albertel Exp $
+## $Id: loncapa_apache.conf,v 1.62 2003/09/11 19:47:30 www Exp $
 ##
 
 #
@@ -687,6 +687,20 @@
 AuthType Basic
 AuthUserFile /home/httpd/lonTabs/htpasswd
 require user  reaper
+</Location>
+
+<Location /cgi-bin/takeoffline.pl>
+AuthName "Offline"
+AuthType Basic
+AuthUserFile /home/httpd/lonTabs/htpasswd
+require user  offline
+</Location>
+
+<Location /cgi-bin/takeonline.pl>
+AuthName "Offline"
+AuthType Basic
+AuthUserFile /home/httpd/lonTabs/htpasswd
+require user  offline
 </Location>
 
 <Location /adm/test>

Index: loncom/cgi/takeoffline.pl
+++ loncom/cgi/takeoffline.pl
#!/usr/bin/perl
# Take machine offline, reroute traffic
#
# $Id: takeoffline.pl,v 1.1 2003/09/11 19:47:30 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# /home/httpd/html/adm/gpl.txt
#
# http://www.lon-capa.org/
#

print "Content-type: text/html\n\n".
      "<html><body bgcolor=#FFFFFF><h1>Take Offline</h1>";
unless ($ENV{'QUERY_STRING'}) {
    print 'No reroute server given, taking completely offline.';
    &dead();
} else {
    $otherserver=$ENV{'QUERY_STRING'};
    print 'Rerouting to '.$otherserver;
    &reroute();
}

print "</body></html>";

sub dead {
    open (OUT,'>/home/httpd/html/index.html');
    print OUT 'This LON-CAPA server is currently offline.';
    close(OUT);
}

sub reroute {
    open (OUT,'>/home/httpd/html/index.html');
    print OUT (<<ENDNEWINDEX);
<html>
 <head>
  <title>Welcome to the LearningOnline Network with CAPA</title>
  <meta HTTP-EQUIV="Refresh" CONTENT="0.5; url=http://$otherserver/adm/roles">
 </head>
 <body bgcolor="#004400" topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>
  <img src="/adm/lonIcons/header.gif" />
<p><font color="#FFFFFF">Connecting to
<a href="http://$otherserver/adm/roles"><font color="#FFFFFF">http://$otherserver/</font></a></font></p>
</body>
</html>
ENDNEWINDEX
   close(OUT);
}

Index: loncom/cgi/takeonline.pl
+++ loncom/cgi/takeonline.pl
#!/usr/bin/perl
# Take machine online
#
# $Id: takeonline.pl,v 1.1 2003/09/11 19:47:30 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# /home/httpd/html/adm/gpl.txt
#
# http://www.lon-capa.org/
#

print "Content-type: text/html\n\n".
      "<html><body bgcolor=#FFFFFF><h1>Take Online</h1>";
system('mv /home/httpd/html/origindex.html /home/httpd/html/index.html');
print "</body></html>";