--- /etc/init.d/samba-ad-dc.orig 2017-02-17 02:47:47.546857284 +0100 +++ /etc/init.d/samba-ad-dc 2017-02-17 02:58:40.130864129 +0100 @@ -32,7 +32,17 @@ case "$1" in . "/usr/share/univention-config-registry/init-autostart.lib" check_autostart samba-ad-dc samba4/autostart fi - SERVER_ROLE=`samba-tool testparm --parameter-name="server role" 2>/dev/null | tail -1` + testparm_output=$(samba-tool testparm --parameter-name="server role" 2>/dev/null) + rc=$? + if [ $rc != 0 ]; then + log_failure_msg "samba-tool testparm" + exit 1 + fi + if [ -z != "$testparm_output" ]; then + log_failure_msg 'samba-tool testparm --parameter-name="server role"' + exit 1 + fi + SERVER_ROLE=$(echo "$testparm_output" | tail -1) if [ "$SERVER_ROLE" != "active directory domain controller" ]; then echo "Samba is not configured as AD DC." exit 0