1
|
#!/bin/sh
|
2
|
|
3
|
mkdir -p /var/db/dnscache
|
4
|
cd /var/db/dnscache
|
5
|
|
6
|
while [ /bin/true ]; do
|
7
|
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
|
# We need to compare the files.
|
21
|
cmp -s /tmp/Njkd98u79.tmp $FILE
|
22
|
if [ "$?" -gt 0 ]; then
|
23
|
needsfilterreload=1
|
24
|
fi
|
25
|
done
|
26
|
if [ "$needsfilterreload" -gt 0 ]; then
|
27
|
/etc/rc.filter_configure_sync
|
28
|
fi
|
29
|
sleep 480
|
30
|
done
|