Package: squid3
Version: 3.3.8-1
Severity: wishlist
Tags: patch
File: /etc/init.d/squid3

I took the liberty to add a config check before doing a
reload/restart of the squid daemon. Please find the patch
attached. I hope you like it.


-- 
$ cat ~/.signature
Freddy Spierenburg <fre...@snarl.nl>         http://freddy.snarl.nl/
GnuPG: 0x7941D1E1=C948 5851 26D2 FA5C 39F1  E588 6F17 FD5D 7941 D1E1
$ # Please read http://www.ietf.org/rfc/rfc2015.txt before complain!
--- squid3.orig	2013-10-29 18:15:35.517383971 +0100
+++ squid3	2013-10-29 18:29:46.645404199 +0100
@@ -150,18 +150,32 @@
 	fi
 	;;
     reload|force-reload)
-	log_action_msg "Reloading $DESC configuration files"
-	start-stop-daemon --stop --signal 1 \
-		--pidfile $PIDFILE --quiet --exec $DAEMON
-	log_action_end_msg 0
+	res=`$DAEMON -k check 2>&1`
+	if test -n "$res";
+	then
+		log_failure_msg "$res"
+		exit 3
+	else
+		log_action_msg "Reloading $DESC configuration files"
+	  	start-stop-daemon --stop --signal 1 \
+			--pidfile $PIDFILE --quiet --exec $DAEMON
+		log_action_end_msg 0
+	fi
 	;;
     restart)
-	log_daemon_msg "Restarting $DESC" "$NAME"
-	stop
-	if start ; then
-		log_end_msg $?
+	res=`$DAEMON -k check 2>&1`
+	if test -n "$res";
+	then
+		log_failure_msg "$res"
+		exit 3
 	else
-		log_end_msg $?
+		log_daemon_msg "Restarting $DESC" "$NAME"
+		stop
+		if start ; then
+			log_end_msg $?
+		else
+			log_end_msg $?
+		fi
 	fi
 	;;
     status)

Reply via email to