瀏覽代碼

Merge branch 'master' of github.com:AloisMahdal/minions

Alois Mahdal 10 年之前
父節點
當前提交
c07ffdfc42
共有 5 個檔案被更改,包括 28 行新增6 行删除
  1. 4
    3
      README.md
  2. 5
    0
      TODO.md
  3. 11
    2
      bin/se
  4. 1
    1
      cgi-bin/htlog/htlog.cgi
  5. 7
    0
      etc/logrotate.d/htlogr

+ 4
- 3
README.md 查看文件

91
 translations of it, one pair per line.  Sweet.  Also supports other languages
91
 translations of it, one pair per line.  Sweet.  Also supports other languages
92
 (about 10 in total).
92
 (about 10 in total).
93
 
93
 
94
-Most useful options are --lines (default is 25) and --direction which supports
95
-direction keyword in form "LNcz.cz" or "LNcz.LN", where LN is 2-letter code
96
-(**not** ISO) of the other language.
94
+Most useful options are `--lines` (default is 25), `--long`, as shorthand
95
+to `--lines=50`, and `--direction`, which supports direction keyword in form
96
+"LNcz.cz" or "LNcz.LN", where LN is 2-letter code (**not** ISO) of the other
97
+language.
97
 
98
 
98
 Uses [www.slovnik.cz][2], so an Internet connection and [LWP::Simple][3] are
99
 Uses [www.slovnik.cz][2], so an Internet connection and [LWP::Simple][3] are
99
 needed.
100
 needed.

+ 5
- 0
TODO.md 查看文件

1
 TODO:
1
 TODO:
2
 =====
2
 =====
3
 
3
 
4
+Update
5
+------
6
+
7
+*   htlogr.pm according to htlogr.py
8
+
4
 Finish
9
 Finish
5
 ------
10
 ------
6
 
11
 

+ 11
- 2
bin/se 查看文件

14
 
14
 
15
 my $direction = 'encz.en';
15
 my $direction = 'encz.en';
16
 my $lines = 25;
16
 my $lines = 25;
17
+my $max_lines = 50;
18
+my $long = 0;
17
 my $man = 0;
19
 my $man = 0;
18
 my $help = 0;
20
 my $help = 0;
19
 my $host = 'www.slovnik.cz';
21
 my $host = 'www.slovnik.cz';
20
 
22
 
21
 GetOptions(
23
 GetOptions(
22
-    'lines|l=i'     => \$lines,
24
+    'long|l'     => \$long,
25
+    'lines|n=i'     => \$lines,
23
     'direction|d=s' => \$direction,
26
     'direction|d=s' => \$direction,
24
     'help|?|h'    => \$help,
27
     'help|?|h'    => \$help,
25
     'man'       => \$man
28
     'man'       => \$man
27
 pod2usage(1) if $help;
30
 pod2usage(1) if $help;
28
 pod2usage(-exitstatus => 0, -verbose => 2) if $man;
31
 pod2usage(-exitstatus => 0, -verbose => 2) if $man;
29
 
32
 
33
+$lines = $max_lines if $long;
34
+
30
 my $word = shift or usage;
35
 my $word = shift or usage;
31
 
36
 
32
 my $query  = sprintf(
37
 my $query  = sprintf(
115
     lacz.la, lacz.cz, eocz.eo, eocz.cz, eosk.eo, eosk.sk,
120
     lacz.la, lacz.cz, eocz.eo, eocz.cz, eosk.eo, eosk.sk,
116
     plcz.pl, plcz.cz
121
     plcz.pl, plcz.cz
117
 
122
 
118
-=item B<-l> I<LINES>, B<--lines=>I<LINES>
123
+=item B<-l>, B<--long>
124
+
125
+Same as C<--lines=50>, which is maximum supported by API
126
+
127
+=item B<-n> I<LINES>, B<--lines=>I<LINES>
119
 
128
 
120
 Number of lines fetched fronm the service and displayed to stdout.
129
 Number of lines fetched fronm the service and displayed to stdout.
121
 Default is 25, but since www.slovnik.cz provides simplistic interface
130
 Default is 25, but since www.slovnik.cz provides simplistic interface

+ 1
- 1
cgi-bin/htlog/htlog.cgi 查看文件

18
 
18
 
19
 use CGI;
19
 use CGI;
20
 
20
 
21
-my $LOG_FILE = 'htlog.log';
21
+my $LOG_FILE = '/var/log/htlogr.log';
22
 open my $fh, ">>", $LOG_FILE or die "cannot open log file for appending: $!";
22
 open my $fh, ">>", $LOG_FILE or die "cannot open log file for appending: $!";
23
 
23
 
24
 sub stamp {
24
 sub stamp {

+ 7
- 0
etc/logrotate.d/htlogr 查看文件

1
+/var/log/htlogr.log {
2
+    weekly
3
+    rotate 8
4
+    compress
5
+    delaycompress
6
+    create 640 www-data adm
7
+}