… | |
… | |
9 | use Text::Abbrev; |
9 | use Text::Abbrev; |
10 | |
10 | |
11 | my $last_ts = time; |
11 | my $last_ts = time; |
12 | |
12 | |
13 | my %complete; |
13 | my %complete; |
14 | my @commands = qw(quit squit refresh country restart block info print); |
14 | my @commands = qw(quit squit refresh country restart block info print clrdiridx); |
15 | |
15 | |
16 | abbrev \%complete, @commands; |
16 | abbrev \%complete, @commands; |
17 | |
17 | |
18 | sub shell { |
18 | sub shell { |
19 | my $fh = shift; |
19 | my $fh = shift; |
… | |
… | |
32 | my @res = eval $_; |
32 | my @res = eval $_; |
33 | print $fh "eval: $@\n" if $@; |
33 | print $fh "eval: $@\n" if $@; |
34 | print $fh "RES = ", (join " : ", @res), "\n"; |
34 | print $fh "RES = ", (join " : ", @res), "\n"; |
35 | } elsif ($cmd eq "block") { |
35 | } elsif ($cmd eq "block") { |
36 | print "blocked '$_'\n";#d# |
36 | print "blocked '$_'\n";#d# |
37 | $conn::blocked{$_} = time + $::BLOCKTIME; |
37 | $conn::blocked{$_} = [time + $::BLOCKTIME, "blocked by operator"]; |
38 | } elsif ($cmd eq "info") { |
38 | } elsif ($cmd eq "info") { |
39 | $::NOW = time+1e-6; |
39 | $::NOW = time+1e-6; |
40 | my @data; |
40 | my @data; |
41 | for (values %conn::conn) { |
41 | for (values %conn::conn) { |
42 | for (values %$_) { |
42 | for (values %$_) { |
… | |
… | |
54 | do "config.pl"; |
54 | do "config.pl"; |
55 | print $fh "config.pl: $@\n" if $@; |
55 | print $fh "config.pl: $@\n" if $@; |
56 | %statdata_cache = (); |
56 | %statdata_cache = (); |
57 | conn::read_blockuri; |
57 | conn::read_blockuri; |
58 | conn::read_blockref; |
58 | conn::read_blockref; |
|
|
59 | } elsif ($cmd eq "clrdiridx") { |
|
|
60 | %statdata_cache = (); |
|
|
61 | delete $diridx{$_} for keys %diridx; # server error on %diridx = (); |
59 | } elsif ($cmd eq "restart") { |
62 | } elsif ($cmd eq "restart") { |
60 | $::RESTART = 1; |
63 | $::RESTART = 1; |
61 | unloop; |
64 | unloop; |
62 | print $fh "restarting, cu!\n"; |
65 | print $fh "restarting, cu!\n"; |
63 | last; |
66 | last; |