File: innstat.in

package info (click to toggle)
inn2 2.4.5-5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,912 kB
  • ctags: 7,860
  • sloc: ansic: 85,104; perl: 11,427; sh: 9,863; makefile: 2,498; yacc: 1,563; python: 298; lex: 252; tcl: 7
file content (79 lines) | stat: -rw-r--r-- 1,780 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#! /bin/sh
# fixscript will replace this line with code to load innshellvars

##  $Revision: 6994 $
##  Display status of INN.
##  Written by Landon Curt Noll <chongo@toad.com>.

SYSLOG_CRIT=news.crit
SYSLOG_ERR=news.err
SYSLOG_NOTICE=news.notice
SYSLOGS="${SYSLOG_CRIT} ${SYSLOG_ERR} ${SYSLOG_NOTICE}"

##  Set up the list of log files.
LOGS="${SYSLOGS}"
if [ -f "${MOST_LOGS}/`basename ${ERRLOG}`" ]; then
    LOGS="${LOGS} `basename ${ERRLOG}`"
else
    LOGS="${LOGS} ${ERRLOG}"
fi
if [ -f "${MOST_LOGS}/`basename ${LOG}`" ]; then
    LOGS="${LOGS} `basename ${LOG}`"
else
    LOGS="${LOGS} ${LOG}"
fi

##  Show INND status.
echo 'Server status:'
ctlinnd mode 2>&1

##  Show disk usage.  You might have to change this.
echo ''
echo 'Disk usage:'
${INNDF} ${SPOOL} ${OVERVIEWDIR} ${PATHETC} ${INCOMING} ${BATCH} \
	${PATHDB} ${MOST_LOGS} | sort -u

##  Show size of batch files.
echo ''
echo 'Batch file sizes:'
( cd ${BATCH}; ls -Cs | sed 1d )

##  Show size of log files.
echo ''
echo 'Log file sizes:'
( cd ${MOST_LOGS}; ls -Cs ${LOGS} *.log 2>&1 )

##  Show the lock files
echo ''
(	cd ${LOCKS}
	set -$- LOCK.*
	if [ -f "$1" ]; then
		echo 'Lock files:'
		ls -C LOCK.* 2>&1
	else
		echo 'Innwatch is not running'
	fi
)

echo ''
echo 'Server connections:'
ctlinnd -t60 name '' 2>&1 \
  | ${PERL} -ne '
     next if m/(^((rem|local)conn|control)|:proc|:file):/;
     s/^(\S+):(\d+):.*:.*:.*$/${1}:${2}/;
     m/^(\S+):(\d+)$/;
     $c{$1} = [] unless $c{$1};
     @l = @{$c{$1}};
     push @l, $2;
     $c{$1} = [@l];
     $m++;
 
     END {
       $n = 0;
       foreach $f (sort {$#{$c{$b}} <=> $#{$c{$a}}} keys %c) {
          printf "%-35.35s %3d  (%s", $f, 1 + $#{$c{$f}}, "@{$c{$f}})\n";
          $n++;
       }
       printf "\n%-35s %3d\n", "TOTAL: $n", $m;
     }'