-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
mk-teams.html.sh
executable file
·74 lines (72 loc) · 1.73 KB
/
mk-teams.html.sh
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
#!/usr/bin/bash
#
# Create teams.html
# Run ~/virtual-school/mk-teams.html.sh > /var/www/html/teams.shtml
# Then edit /var/www/html/teams.shtml
#
cat << HEADER
<html>
<head>
<title>Teams!</title>
<style>
.resips { visibility: hidden; }
table {
border-spacing: 0;
border-collapse: collapse;
}
th {
border-bottom: 2px solid black;
}
td {
border-top: 1px solid black;
}
.odd { background-color: #F0F0F0; }
.even { background-color: #F8F8F8; }
</style>
</head>
<body>
<!--#include virtual="/menu.html" -->
<table>
<colgroup>
<col style="width: 5em" />
<col style="width: 10em" />
<col style="width: 11.5em" />
<col style="width: 11.5em" />
<col style="width: 10em" />
</colgroup>
<thead>
<tr class="header">
<th style="text-align: center;">Team</th>
<th style="text-align: center;">Members</th>
<th style="text-align: left;">Resolver</th>
<th style="text-align: left;">Authoritative</th>
<th style="text-align: right;">Domains</th>
</tr>
</thead>
<tbody>
HEADER
for n in $(eval echo {0..$(awk '/^num_vms/{print$3-1}' ${0%/*}/terraform.tfvars)})
do
RES_A=`dig res-$n.do.dns-school.org A +short`
RES_AAAA=`dig res-$n.do.dns-school.org AAAA +short`
AUTH_A=`dig auth-$n.do.dns-school.org A +short`
AUTH_AAAA=`dig auth-$n.do.dns-school.org AAAA +short`
if [ "$ODD" = "odd" ]
then
ODD=even
else
ODD=odd
fi
cat << ENTRY
<tr class="$ODD">
<td style="text-align: center;">team-$n</td>
<td style="text-align: center;"> </td>
<td style="text-align: left; vertical-align: top;">res-$n.do.dns-school.org <span class="resips">$RES_A $RES_AAAA</span></td>
<td style="text-align: left; vertical-align: top;">auth-$n.do.dns-school.org $AUTH_A $AUTH_AAAA</td>
<td style="text-align: right;">.bangkok.lol</td>
</tr>
ENTRY
done
cat << FOOTER
</tbody></table></body>
FOOTER