2
0
Эх сурвалжийг харах

Check if ser configuration is valid before restarting the server.
If configuration is broken, fix it, then do again:

/etc/init.d/ser restart

Valid for restarts only (start/stop not affected).

Adrian Georgescu 21 жил өмнө
parent
commit
d0812f1c29
1 өөрчлөгдсөн 7 нэмэгдсэн , 0 устгасан
  1. 7 0
      debian/ser.init

+ 7 - 0
debian/ser.init

@@ -55,6 +55,13 @@ case "$1" in
 	#	option to the "reload" entry above. If not, "force-reload" is
 	#	just the same as "restart".
 	#
+	# Check if ser configuration is valid before restarting the server
+	out=`($DAEMON -c >/dev/null || true) 2>&1`
+	if [ "$out" != 'config file ok, exiting...' ]; then
+	    echo -e "\nThere are errors in the configuration file. Please fix them first"
+	    echo -e "\n$out\n"
+	    exit 0
+	fi
 	echo -n "Restarting $DESC: $NAME"
 	start-stop-daemon --oknodo --stop --quiet --pidfile \
 		$PIDFILE --exec $DAEMON