--- loncom/loncron 2014/12/16 18:18:44 1.101 +++ loncom/loncron 2015/05/28 23:50:15 1.102 @@ -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 @@ sub start_logging {
  • Machine Information
  • Temporary Files
  • Session Tokens
  • +
  • WebDAV Session Tokens
  • httpd
  • lonsql
  • lond
  • @@ -499,6 +500,32 @@ sub clean_lonIDs { &log($fh,"

    $active open session(s)

    "); } +# ------------------------------------------------ clean out webDAV Session IDs +sub clean_webDAV_sessionIDs { + my ($fh)=@_; + if ($perlvar{'lonRole'} eq 'library') { + &log($fh,'

    WebDAV Session Tokens

    '); + 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
    "); + unlink("$fname"); + } else { + $active++; + } + } + &log($fh,"

    Cleaned up ".$cleaned." stale webDAV session token(s).

    "); + &log($fh,"

    $active open webDAV session(s)

    "); + } + } +} + # ----------------------------------------------------------- clean out sockets sub clean_sockets { my ($fh)=@_; @@ -933,6 +960,7 @@ sub main () { &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);