1 |
bec6d7ff
|
Scott Ullrich
|
#!/bin/sh
|
2 |
|
|
|
3 |
6a0161b3
|
Seth Mos
|
mkdir -p /var/db/dnscache
|
4 |
|
|
cd /var/db/dnscache
|
5 |
655f0132
|
Scott Ullrich
|
|
6 |
bec6d7ff
|
Scott Ullrich
|
while [ /bin/true ]; do
|
7 |
6a0161b3
|
Seth Mos
|
cd /var/db/dnscache
|
8 |
|
|
needsfilterreload=0
|
9 |
|
|
for FILE in *; do
|
10 |
|
|
DNSENTRIES=`host -t A $FILE | awk '/address/ {print $4}' | sort`
|
11 |
|
|
echo "$DNSENTRIES" > /tmp/Njkd98u79.tmp
|
12 |
|
|
CURRENTNR=`cat /tmp/Njkd98u79.tmp | wc -l | awk '{print $1}'`
|
13 |
|
|
OLDNR=`cat $FILE | wc -l | awk '{print $1}'`
|
14 |
|
|
if [ "$CURRENTNR" != "$OLDNR" ]; then
|
15 |
|
|
needsfilterreload=1
|
16 |
|
|
# if the number of hosts is different we reload and skip the rest
|
17 |
|
|
continue
|
18 |
|
|
fi
|
19 |
|
|
# We need to compare the files.
|
20 |
067502de
|
Seth Mos
|
# We need to compare the files.
|
21 |
|
|
cmp -s /tmp/Njkd98u79.tmp $FILE
|
22 |
|
|
if [ "$?" -gt 0 ]; then
|
23 |
|
|
needsfilterreload=1
|
24 |
|
|
fi
|
25 |
6a0161b3
|
Seth Mos
|
done
|
26 |
|
|
if [ "$needsfilterreload" -gt 0 ]; then
|
27 |
|
|
/etc/rc.filter_configure_sync
|
28 |
|
|
fi
|
29 |
|
|
sleep 480
|
30 |
bec6d7ff
|
Scott Ullrich
|
done
|