chiark / gitweb /
check responses are in right phase for article; implement notice_processed
[inn-innduct.git] / scripts / innstat.in
1 #! /bin/sh
2 # fixscript will replace this line with code to load innshellvars
3
4 ##  $Revision: 6994 $
5 ##  Display status of INN.
6 ##  Written by Landon Curt Noll <chongo@toad.com>.
7
8 SYSLOG_CRIT=news.crit
9 SYSLOG_ERR=news.err
10 SYSLOG_NOTICE=news.notice
11 SYSLOGS="${SYSLOG_CRIT} ${SYSLOG_ERR} ${SYSLOG_NOTICE}"
12
13 ##  Set up the list of log files.
14 LOGS="${SYSLOGS}"
15 if [ -f "${MOST_LOGS}/`basename ${ERRLOG}`" ]; then
16     LOGS="${LOGS} `basename ${ERRLOG}`"
17 else
18     LOGS="${LOGS} ${ERRLOG}"
19 fi
20 if [ -f "${MOST_LOGS}/`basename ${LOG}`" ]; then
21     LOGS="${LOGS} `basename ${LOG}`"
22 else
23     LOGS="${LOGS} ${LOG}"
24 fi
25
26 ##  Show INND status.
27 echo 'Server status:'
28 ctlinnd mode 2>&1
29
30 ##  Show disk usage.  You might have to change this.
31 echo ''
32 echo 'Disk usage:'
33 ${INNDF} ${SPOOL} ${OVERVIEWDIR} ${PATHETC} ${INCOMING} ${BATCH} \
34         ${PATHDB} ${MOST_LOGS} | sort -u
35
36 ##  Show size of batch files.
37 echo ''
38 echo 'Batch file sizes:'
39 ( cd ${BATCH}; ls -Cs | sed 1d )
40
41 ##  Show size of log files.
42 echo ''
43 echo 'Log file sizes:'
44 ( cd ${MOST_LOGS}; ls -Cs ${LOGS} *.log 2>&1 )
45
46 ##  Show the lock files
47 echo ''
48 (       cd ${LOCKS}
49         set -$- LOCK.*
50         if [ -f "$1" ]; then
51                 echo 'Lock files:'
52                 ls -C LOCK.* 2>&1
53         else
54                 echo 'Innwatch is not running'
55         fi
56 )
57
58 echo ''
59 echo 'Server connections:'
60 ctlinnd -t60 name '' 2>&1 \
61   | ${PERL} -ne '
62      next if m/(^((rem|local)conn|control)|:proc|:file):/;
63      s/^(\S+):(\d+):.*:.*:.*$/${1}:${2}/;
64      m/^(\S+):(\d+)$/;
65      $c{$1} = [] unless $c{$1};
66      @l = @{$c{$1}};
67      push @l, $2;
68      $c{$1} = [@l];
69      $m++;
70  
71      END {
72        $n = 0;
73        foreach $f (sort {$#{$c{$b}} <=> $#{$c{$a}}} keys %c) {
74           printf "%-35.35s %3d  (%s", $f, 1 + $#{$c{$f}}, "@{$c{$f}})\n";
75           $n++;
76        }
77        printf "\n%-35s %3d\n", "TOTAL: $n", $m;
78      }'
79