Debian Codegraph @

contrib/gentcucci-1.0.0/tcnowstat

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 grep_itscip-shell shell shell-project 0.0.0 grep_it().() {
4 value="`catscip-shell system . . cat. $TEMP_FILE | headscip-shell system . . head. -$1 | tailscip-shell system . . tail. -1`"
5 perc="`exprscip-shell system . . expr. \"$value\" \* 100 /scip-shell filesystem . . `/`. \"${MAXB:=1}\"`"
6 color=""
7 if [scip-shell system . . `[`. ${perc:=0} -ge 90 ]
8 then
9 color=" bgcolor=red"
10 elif [scip-shell system . . `[`. ${perc:=0} -ge 80 ]
11 then
12 color=" bgcolor=yellow"
13 elif [scip-shell system . . `[`. ${perc:=0} -le 25 ]
14 then
15 color=" bgcolor=cyan"
16 else
17 color=" bgcolor=lightgreen"
18 fi
19 echoscip-shell system . . echo. " <td>$value</td><td$color>${perc}%</td>"
20 }
21
22 ###############################################################################
23
24 export DIR=/usr/local/mrtg-2.8.12/local-config/www/tcusercountscip-shell filesystem . . `/usr/local/mrtg-2.8.12/local-config/www/tcusercount`.
25 export MACH="`echoscip-shell system . . echo. \"$1\" | sedscip-shell system . . sed. -e 's/+/_/g'`"
26 export MAXB="$2"
27 export TEMP_FILE=/tmp/tcnowstat.$$
28
29 ###############################################################################
30
31 if [scip-shell system . . `[`. ! -r "$DIR/${MACH}.html" ]
32 then
33 exit
34 fi
35
36 catscip-shell system . . cat. "$DIR/${MACH}.html" | \
37 grep '<\!-- ' | \
38 grep "in " | \
39 cut -d' ' -f4 >$TEMP_FILE
40 trap "rm -f $TEMP_FILE ; exit" 1 2 15
41
42 echoscip-shell system . . echo. ""
43 echoscip-shell system . . echo. " <table border>"
44 echoscip-shell system . . echo. " <tr>"
45 echoscip-shell system . . echo. " <td></td>"
46 echoscip-shell system . . echo. " <td colspan=2 align=center>Max</td>"
47 echoscip-shell system . . echo. " <td colspan=2 align=center>Avg</td>"
48 echoscip-shell system . . echo. " <td colspan=2 align=center>Now</td>"
49 echoscip-shell system . . echo. " </tr>"
50 echoscip-shell system . . echo. " <tr>"
51 echoscip-shell system . . echo. " <td>Day</td>"
52 grep_itscip-shell shell shell-project 0.0.0 grep_it(). 1
53 grep_itscip-shell shell shell-project 0.0.0 grep_it(). 2
54 grep_itscip-shell shell shell-project 0.0.0 grep_it(). 3
55 echoscip-shell system . . echo. " </tr>"
56 echoscip-shell system . . echo. " <tr>"
57 echoscip-shell system . . echo. " <td>Week</td>"
58 grep_itscip-shell shell shell-project 0.0.0 grep_it(). 4
59 grep_itscip-shell shell shell-project 0.0.0 grep_it(). 5
60 grep_itscip-shell shell shell-project 0.0.0 grep_it(). 6
61 echoscip-shell system . . echo. " </tr>"
62 echoscip-shell system . . echo. " <tr>"
63 echoscip-shell system . . echo. " <td>Month</td>"
64 grep_itscip-shell shell shell-project 0.0.0 grep_it(). 7
65 grep_itscip-shell shell shell-project 0.0.0 grep_it(). 8
66 grep_itscip-shell shell shell-project 0.0.0 grep_it(). 9
67 echoscip-shell system . . echo. " </tr>"
68 echoscip-shell system . . echo. " <tr>"
69 echoscip-shell system . . echo. " <td>Year</td>"
70 grep_itscip-shell shell shell-project 0.0.0 grep_it(). 10
71 grep_itscip-shell shell shell-project 0.0.0 grep_it(). 11
72 grep_itscip-shell shell shell-project 0.0.0 grep_it(). 12
73 echoscip-shell system . . echo. " </tr>"
74 echoscip-shell system . . echo. " </table>"
75 echoscip-shell system . . echo. ""
76
77 trap - 1 2 15
78 rmscip-shell system . . rm. -f $TEMP_FILE 2>/dev/nullscip-shell filesystem . . `/dev/null`.