equal
deleted
inserted
replaced
42 fi |
42 fi |
43 } |
43 } |
44 |
44 |
45 ## Test DHCP configuration for validity using dhcpd -t: |
45 ## Test DHCP configuration for validity using dhcpd -t: |
46 # |
46 # |
47 # check_dhcp [$conf] |
47 # check_dhcp |
48 # |
48 # |
49 # Defaults to the global $DHCPD_CONF. |
49 # Uses the global $DHCPD_CONF, |
50 # Fails if the check fails. |
|
51 function test_dhcp { |
50 function test_dhcp { |
52 local conf="$1" |
|
53 |
|
54 if [ ! -e "$DHCP_SBIN" ]; then |
51 if [ ! -e "$DHCP_SBIN" ]; then |
55 log_warn "check_dhcp: dhcpd not installed, skipping: $conf" |
52 log_warn "check_dhcp: dhcpd not installed, skipping: $conf" |
56 return 0 |
53 return 0 |
57 fi |
54 fi |
58 |
55 |
59 log_check "Checking DHCP: $conf" |
56 log_check "Checking DHCP: $DHCP_CONF" |
60 |
57 |
61 test_cmd "$conf" \ |
58 test_cmd "$conf" \ |
62 "$DHCP_SBIN" -cf "$conf" -t |
59 "$DHCP_SBIN" -cf "$DHCP_CONF" -t |
63 } |
60 } |
64 |
61 |
65 ## Reload dhcp hosts |
62 ## Reload dhcp hosts |
66 # |
63 # |
67 # reload_dhcp |
64 # reload_dhcp |
79 elif [ ! -e "$DHCP_SBIN" ]; then |
76 elif [ ! -e "$DHCP_SBIN" ]; then |
80 warn "Skip missing DHCP" |
77 warn "Skip missing DHCP" |
81 |
78 |
82 return |
79 return |
83 |
80 |
84 elif ! test_dhcp "$DHCP_CONF"; then |
|
85 log_error "Skip config error DHCP" |
|
86 |
|
87 elif ! service_status $DHCP_SERVICE; then |
81 elif ! service_status $DHCP_SERVICE; then |
88 log_skip "dhcpd not running; did not restart" |
82 log_skip "dhcpd not running; did not restart" |
89 |
83 |
90 return |
84 return |
91 |
85 |