Commit 35d5680 1 parent cb796db commit 35d5680 Copy full SHA for 35d5680
File tree 1 file changed +25
-10
lines changed
1 file changed +25
-10
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
3
- while true ; do
4
- ATIME=` stat /etc/dhcpd/dhcpd-leases.log | grep Modify`
5
-
6
- if [[ " $ATIME " != " $LTIME " ]]; then
7
- date
8
- echo " dhcp leases changed - reloading DNS"
9
- /var/services/homes/admin/diskstation_dns_modify.sh
10
- LTIME=$ATIME
11
- fi
12
- sleep 5
3
+ while true ; do
4
+ reload_dns=false
5
+ if [ -r /etc/dhcpd/dhcpd-leases.log ]; then
6
+ LOGATIME=` stat /etc/dhcpd/dhcpd-leases.log | grep Modify`
7
+ if [ " $LOGATIME " != " $LOGLASTATIME " ]; then
8
+ date
9
+ LOGLASTATIME=$LOGATIME
10
+ reload_dns=true
11
+ fi
12
+ elif [ -r /etc/dhcpd/dhcpd.conf.leases ]; then
13
+ LEASEATIME=` stat /etc/dhcpd/dhcpd.conf.leases | grep Modify`
14
+ if [ " $LEASEATIME " != " $LEASELASTATIME " ]; then
15
+ date
16
+ LEASELASTATIME=$LEASEATIME
17
+ reload_dns=true
18
+ fi
19
+ else
20
+ echo " ERROR - No dhcp lease files found. Is something misconfigured?"
21
+ exit 1
22
+ fi
23
+ if " $reload_dns " ; then
24
+ echo " dhcp leases changed - reloading DNS"
25
+ /var/services/homes/admin/diskstation_dns_modify.sh
26
+ fi
27
+ sleep 5
13
28
done
14
29
15
30
You can’t perform that action at this time.
0 commit comments