[LON-CAPA-cvs] cvs: loncom / loncron

raeburn raeburn at source.lon-capa.org
Thu May 28 19:50:15 EDT 2015


raeburn		Thu May 28 23:50:15 2015 EDT

  Modified files:              
    /loncom	loncron 
  Log:
  - WebDAV session housekeeping.
  
  
Index: loncom/loncron
diff -u loncom/loncron:1.101 loncom/loncron:1.102
--- loncom/loncron:1.101	Tue Dec 16 18:18:44 2014
+++ loncom/loncron	Thu May 28 23:50:15 2015
@@ -2,7 +2,7 @@
 
 # Housekeeping program, started by cron, loncontrol and loncron.pl
 #
-# $Id: loncron,v 1.101 2014/12/16 18:18:44 raeburn Exp $
+# $Id: loncron,v 1.102 2015/05/28 23:50:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -300,6 +300,7 @@
 <li><a href="#machine">Machine Information</a></li>
 <li><a href="#tmp">Temporary Files</a></li>
 <li><a href="#tokens">Session Tokens</a></li>
+<li><a href="#webdav">WebDAV Session Tokens</a></li>
 <li><a href="#httpd">httpd</a></li>
 <li><a href="#lonsql">lonsql</a></li>
 <li><a href="#lond">lond</a></li>
@@ -499,6 +500,32 @@
     &log($fh,"<h3>$active open session(s)</h3>");
 }
 
+# ------------------------------------------------ clean out webDAV Session IDs
+sub clean_webDAV_sessionIDs {
+    my ($fh)=@_;
+    if ($perlvar{'lonRole'} eq 'library') {
+        &log($fh,'<hr /><a name="webdav" /><h2>WebDAV Session Tokens</h2>');
+        my $cleaned=0;
+        my $active=0;
+        my $now = time;
+        if (-d $perlvar{'lonDAVsessDir'}) {
+            while (my $fname=<$perlvar{'lonDAVsessDir'}/*>) {
+                my @stats = stat($fname);
+                my $since=$now-$stats[9];
+                if ($since>$perlvar{'lonExpire'}) {
+                    $cleaned++;
+                    &log($fh,"Unlinking $fname<br />");
+                    unlink("$fname");
+                } else {
+                    $active++;
+                }
+            }
+            &log($fh,"<p>Cleaned up ".$cleaned." stale webDAV session token(s).</p>");
+            &log($fh,"<h3>$active open webDAV session(s)</h3>");
+        }
+    }
+}
+
 # ----------------------------------------------------------- clean out sockets
 sub clean_sockets {
     my ($fh)=@_;
@@ -933,6 +960,7 @@
 	&log_machine_info($fh);
 	&clean_tmp($fh);
 	&clean_lonIDs($fh);
+        &clean_webDAV_sessionIDs($fh);
 	&check_httpd_logs($fh);
 	&rotate_lonnet_logs($fh);
 	&rotate_other_logs($fh);




More information about the LON-CAPA-cvs mailing list