Pound init script could be modified to be able to check the configuration file syntax. Pound has a "-c" option that enables this: -c Check only: Pound will exit immediately after parsing the configuration file. This may be used for running a quick syntax check before actually activating a server. # diff -u /usr/portage/www-servers/pound/files/pound.init-1.9 /etc/init.d/pound --- /usr/portage/www-servers/pound/files/pound.init-1.9 2005-07-07 17:45:08.000000000 +0200 +++ /etc/init.d/pound 2013-07-03 13:59:11.762440558 +0200 @@ -3,16 +3,42 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/www-servers/pound/files/pound.init-1.9,v 1.1 2005/07/07 15:45:08 mkennedy Exp $ +extra_commands="configtest" + +description_configtest="Run syntax tests for configuration files." + +POUND="/usr/sbin/pound" +CONFIGFILE="/etc/pound.cfg" + depend() { need net } +configtest() { + ebegin "Checking ${SVCNAME} configuration" + checkconfig + eend $? +} + +checkconfig() { + ${POUND} -c >/dev/null 2>&1 + ret=$? + if [ $ret -ne 0 ]; then + eerror "${SVCNAME} has detected an error in your setup:" + ${POUND} -c + fi + + return $ret +} + start() { + checkconfig || return 1 + ebegin "Starting pound" - if [ ! -f "/etc/pound.cfg" ]; then - eend 1 "configfile /etc/pound.cfg not found." + if [ ! -f "${CONFIGFILE}" ]; then + eend 1 "configfile ${CONFIGFILE} not found." fi - start-stop-daemon --quiet --start --exec /usr/sbin/pound -- -f /etc/pound.cfg -p /var/run/pound.pid + start-stop-daemon --quiet --start --exec ${POUND} -- -f ${CONFIGFILE} -p /var/run/pound.pid eend $? }