X-Git-Url: https://git.treefish.org/fex.git/blobdiff_plain/e5c93609849bda051fff54b5d5265af5608c6c69..20160104:/bin/fex_cleanup diff --git a/bin/fex_cleanup b/bin/fex_cleanup index 1adec4e..2dabc00 100755 --- a/bin/fex_cleanup +++ b/bin/fex_cleanup @@ -71,60 +71,60 @@ chdir $spooldir or die "$0: $spooldir - $!\n"; # clean up regular spool opendir $spooldir,'.' or die "$0: $spooldir - $!\n"; while ($to = readdir $spooldir) { + next if $to =~ /^\./; next if $to !~ /@/ or $_ = readlink($to) and not /\//; + next unless -d $to; if (@demo and -f "$to/.demo" and time > lmtime("$to/.demo")+$demo[1]*DS) { logdel($to,"demo user $to deleted"); next; } - if (-d $to and $to !~ /^\./) { - unless (opendir TO,$to) { - warn "$0: $spooldir/$to - $!\n"; - next; - } - while ($from = readdir TO) { - next if $from !~ /@/; - if ($from eq '@GROUP') { - foreach $group (glob "$to/$from/*") { - if (readlink $group and not -f $group) { - logdel($group,"$group deleted (master has gone)"); - } + unless (opendir TO,$to) { + warn "$0: $spooldir/$to - $!\n"; + next; + } + while ($from = readdir TO) { + next if $from !~ /@/; + if ($from eq '@GROUP') { + foreach $group (glob "$to/$from/*") { + if (readlink $group and not -f $group) { + logdel($group,"$group deleted (master has gone)"); } - } else { - if (-d "$to/$from" and $from !~ /^\./) { - unless (opendir FROM,"$to/$from") { - warn "$0: $spooldir/$to/$from - $!\n"; - next; - } - while ($file = readdir FROM) { - next if $file eq '.' or $file eq '..'; - if (-d "$to/$from/$file" and $file !~ /^\./) { - cleanup($to,$from,$file); - rmdir "$to/$from/$file" unless $opt_d; - } + } + } else { + if (-d "$to/$from" and $from !~ /^\./) { + unless (opendir FROM,"$to/$from") { + warn "$0: $spooldir/$to/$from - $!\n"; + next; + } + while ($file = readdir FROM) { + next if $file eq '.' or $file eq '..'; + if (-d "$to/$from/$file" and $file !~ /^\./) { + cleanup($to,$from,$file); + rmdir "$to/$from/$file" unless $opt_d; } - closedir FROM; - rmdir "$to/$from" unless $opt_d; } + closedir FROM; + rmdir "$to/$from" unless $opt_d; } } - closedir TO; - unless (-f "$to/\@PERSISTENT" or $to eq $admin) { - @glob = glob "$to/*/* $to/\@MAINUSER/* $to/\@GROUP/*"; - unless (@glob or -f "$to/\@") { - logdel($to,"$to deleted"); - } - $user = $to; - if ($login_check and -l "$user/.login") { - my $lc = &$login_check(readlink("$user/.login")); - if ($lc) { - if (-f "$user/\@~" and not "$user/@") { - rename "$user/\@~","$user/@" unless $opt_d; - logv("$user reanimated (login_check)"); - } - } else { - rename "$user/@","$user/\@~" unless $opt_d; - logv("$user deactivated (login_check)"); + } + closedir TO; + unless (-f "$to/\@PERSISTENT" or $to eq $admin) { + @glob = glob "$to/*/* $to/\@MAINUSER/* $to/\@GROUP/*"; + unless (@glob or -f "$to/\@") { + logdel($to,"$to deleted"); + } + $user = $to; + if ($login_check and -l "$user/.login") { + my $lc = &$login_check(readlink("$user/.login")); + if ($lc) { + if (-f "$user/\@~" and not "$user/@") { + rename "$user/\@~","$user/@" unless $opt_d; + logv("$user reanimated (login_check)"); } + } else { + rename "$user/@","$user/\@~" unless $opt_d; + logv("$user deactivated (login_check)"); } } } @@ -350,7 +350,7 @@ if ($account_expire and $account_expire =~ /^(\d+)/) { if (time > lmtime($user)+$expire*DS) { # print "$spooldir/$user\n"; - my $locale = readlink "$user/\@LOCALE"; + local $locale = readlink "$user/\@LOCALE"; $locale = 'english' unless $locale and $reactivation{$locale}; &{$reactivation{$locale}}($expire,$user); sleep 1;