| 55 | | connectedb= |
|---|
| 56 | | for conb in $(cat /tmp/usageb.txt); do |
|---|
| 57 | | connectedb="${connectedb:+$connectedb} $conb" |
|---|
| 58 | | done |
|---|
| 59 | | usageb=$(echo $connectedb | sed 's!> <!><!g') |
|---|
| | 57 | # |
|---|
| | 58 | #connectedb= |
|---|
| | 59 | #for conb in $(cat /tmp/usageb.txt); do |
|---|
| | 60 | # connectedb="${connectedb:+$connectedb} $conb" |
|---|
| | 61 | #done |
|---|
| | 62 | #usageb=$(echo $connectedb | sed 's!> <!><!g') |
|---|
| | 63 | # |
|---|
| | 64 | #connectedc= |
|---|
| | 65 | #for conc in $(cat /tmp/usagec.txt); do |
|---|
| | 66 | # connectedc="${connectedc:+$connectedc} $conc" |
|---|
| | 67 | #done |
|---|
| | 68 | #usagec=$(echo $connectedc | sed 's!> <!><!g') |
|---|
| 67 | | uptime="$(uptime)" |
|---|
| | 71 | # uptime gives a one line display of the following information. |
|---|
| | 72 | # The current time, how long the system has been running, how many users are currently logged on, |
|---|
| | 73 | # and the system load averages for the past 1, 5, and 15 minutes. |
|---|
| | 74 | # (http://linux.die.net/man/1/uptime) |
|---|
| | 75 | ut="`uptime | awk -F"," '{print $1 $2}'`" |
|---|
| | 76 | if [ "`echo $ut | awk '{print $4}'`" != "days" ]; then |
|---|
| | 77 | uptime="`echo $ut | awk '{print $3}'` @TR<<hours>>" |
|---|
| | 78 | else |
|---|
| | 79 | uptime="`echo $ut | awk '{print $3}'` @TR<<days>>, `echo $ut | awk '{print $5}'` @TR<<hours>>" |
|---|
| | 80 | fi |
|---|
| 69 | | cat <<EOF |
|---|
| 70 | | <table width="90%"> |
|---|
| 71 | | <tr><td><p><strong>@TR<<Router's time, uptime and load average>></strong></p></td></tr> |
|---|
| 72 | | <tr><td>$uptime</td></tr> |
|---|
| 73 | | <tr><td>$usagea<br /><font size="2">@TR<<One minute based CPU load average>></font><br /><br />$usageb<br /><font size="2">@TR<<5 minutes based CPU load average>></font><br /><br />$usagec<br /><font size="2">@TR<<15 minutes based CPU load average>></font></td></tr> |
|---|
| 74 | | </table> |
|---|
| | 82 | display_form <<EOF |
|---|
| | 83 | start_table|0|10|5 |
|---|
| | 84 | add_row |
|---|
| | 85 | add_title_cell|@TR<<CPU>> |
|---|
| | 86 | end_row |
|---|
| | 87 | add_row |
|---|
| | 88 | add_label_cell|@TR<<Uptime>> |
|---|
| | 89 | add_label_cell|$uptime |
|---|
| | 90 | end_row |
|---|
| | 91 | add_row |
|---|
| | 92 | add_label_cell|@TR<<Average Load>> |
|---|
| | 93 | add_label_cell|$usagea <br /><font size="2">(@TR<<One minute based CPU load average>>)</font><br /><br /> |
|---|
| | 94 | end_row |
|---|
| | 95 | end_table |
|---|
| | 96 | EOF |
|---|
| | 97 | |
|---|
| | 98 | lan_rx=$(ifconfig $lan_ifname | grep "RX bytes" | awk -F"(" '{print $2}' | awk -F")" '{print $1}') |
|---|
| | 99 | lan_tx=$(ifconfig $lan_ifname | grep "RX bytes" | awk -F"(" '{print $3}' | awk -F")" '{print $1}') |
|---|
| | 100 | wan_rx=$(ifconfig $wan_ifname | grep "RX bytes" | awk -F"(" '{print $2}' | awk -F")" '{print $1}') |
|---|
| | 101 | wan_tx=$(ifconfig $wan_ifname | grep "RX bytes" | awk -F"(" '{print $3}' | awk -F")" '{print $1}') |
|---|
| | 102 | hotspot_rx=$(ifconfig tun0 | grep "RX bytes" | awk -F"(" '{print $2}' | awk -F")" '{print $1}') |
|---|
| | 103 | hotspot_tx=$(ifconfig tun0 | grep "RX bytes" | awk -F"(" '{print $3}' | awk -F")" '{print $1}') |
|---|
| | 104 | |
|---|
| | 105 | display_form <<EOF |
|---|
| | 106 | start_table|0|10|5 |
|---|
| | 107 | add_row |
|---|
| | 108 | add_title_cell|@TR<<Traffic>> |
|---|
| | 109 | end_row |
|---|
| | 110 | add_row |
|---|
| | 111 | add_label_cell|<i>@TR<<LAN>>:</i> |
|---|
| | 112 | end_row |
|---|
| | 113 | add_row |
|---|
| | 114 | add_label_cell|@TR<<transmitted>> |
|---|
| | 115 | add_label_cell|$lan_tx |
|---|
| | 116 | end_row |
|---|
| | 117 | add_row |
|---|
| | 118 | add_label_cell|@TR<<received>> |
|---|
| | 119 | add_label_cell|$lan_rx |
|---|
| | 120 | end_row |
|---|
| | 121 | add_row |
|---|
| | 122 | add_label_cell|<i>@TR<<WAN>>:</i> |
|---|
| | 123 | end_row |
|---|
| | 124 | add_row |
|---|
| | 125 | add_label_cell|@TR<<transmitted>> |
|---|
| | 126 | add_label_cell|$wan_tx |
|---|
| | 127 | end_row |
|---|
| | 128 | add_row |
|---|
| | 129 | add_label_cell|@TR<<received>> |
|---|
| | 130 | add_label_cell|$wan_rx |
|---|
| | 131 | end_row |
|---|
| | 132 | add_row |
|---|
| | 133 | add_label_cell|<i>@TR<<Hotspot>>:</i> |
|---|
| | 134 | end_row |
|---|
| | 135 | add_row |
|---|
| | 136 | add_label_cell|@TR<<transmitted>> |
|---|
| | 137 | add_label_cell|$hotspot_tx |
|---|
| | 138 | end_row |
|---|
| | 139 | add_row |
|---|
| | 140 | add_label_cell|@TR<<received>> |
|---|
| | 141 | add_label_cell|$hotspot_rx |
|---|
| | 142 | end_row |
|---|
| | 143 | end_table |
|---|