# configtest itself
configtest() {
- local rc out
- out=`/sbin/dhcpd -t 2>&1`; rc=$?
- if [ $rc -gt 0 ]; then
- echo >&2 "$out"
- fi
+ local rc=0
+ /sbin/dhcpd -q -t -T || rc=$?
# check if interfaces specified exist and have addresses
for i in $DHCPD_INTERFACES; do
return $rc
}
-# wrapper for configtest:
+# wrapper for configtest
checkconfig() {
local details=${1:-0}
if [ $details = 1 ]; then
# run config test and display report (status action)
- show "Checking %s configuration" "DHCP Server"; busy; echo
- configtest
+ show "Checking %s configuration" "DHCP Server"; busy
+ local out
+ out=$(configtest 2>&1)
RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ ok
+ else
+ fail
+ fi
+ [ "$out" ] && echo >&2 "$out"
else
# run config test and abort with nice message if failed
# (for actions checking status before action).
RETVAL=$?
if [ $RETVAL != 0 ]; then
show "Checking %s configuration" "DHCP Server"; fail
- echo >&2 "Configuration test failed. Run \"$0 checkconfig\" to see errors."
+ nls 'Configuration test failed. See details with %s "checkconfig"' $0
exit $RETVAL
fi
fi
checkconfig
msg_starting "DHCP Server"
- daemon /sbin/dhcpd $DHCPD_INTERFACES
+ daemon /sbin/dhcpd -q $DHCPD_INTERFACES
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd
}
force-reload)
condrestart 7
;;
- checkconfig)
+ checkconfig|configtest)
checkconfig 1
;;
status)