svn commit: r398231 - in head/www/squid: . files

Bryan Drewery bdrewery at FreeBSD.org
Wed Sep 30 18:58:06 UTC 2015


Author: bdrewery
Date: Wed Sep 30 18:58:04 2015
New Revision: 398231
URL: https://svnweb.freebsd.org/changeset/ports/398231

Log:
  rc.d/squid: Check the config before starting, reloading, or restarting.

Modified:
  head/www/squid/Makefile
  head/www/squid/files/squid.in

Modified: head/www/squid/Makefile
==============================================================================
--- head/www/squid/Makefile	Wed Sep 30 18:34:59 2015	(r398230)
+++ head/www/squid/Makefile	Wed Sep 30 18:58:04 2015	(r398231)
@@ -2,6 +2,7 @@
 
 PORTNAME=	squid
 PORTVERSION=	3.5.9
+PORTREVISION=	1
 CATEGORIES=	www ipv6
 MASTER_SITES=	http://www.squid-cache.org/Versions/v3/${PORTVERSION:R}/ \
 		http://www2.us.squid-cache.org/Versions/v3/${PORTVERSION:R}/ \

Modified: head/www/squid/files/squid.in
==============================================================================
--- head/www/squid/files/squid.in	Wed Sep 30 18:34:59 2015	(r398230)
+++ head/www/squid/files/squid.in	Wed Sep 30 18:58:04 2015	(r398231)
@@ -51,12 +51,15 @@ rcvar=squid_enable
 # Make sure that we invoke squid with "-f ${squid_conf}"; define this
 # variable early so reload_cmd and stop_precmd pick it up:
 
-extra_commands=reload
+extra_commands="reload configtest"
 reload_cmd=squid_reload
 start_precmd=squid_prestart
 start_postcmd=squid_getpid
 stop_precmd=squid_prestop
 stop_postcmd=squid_poststop
+configtest_cmd=squid_configtest
+reload_precmd=squid_configtest
+restart_precmd=squid_configtest
 
 # squid(8) will not start if ${squid_conf} is not present so try
 # to catch that beforehand via ${required_files} rather than make
@@ -105,6 +108,8 @@ squid_prestart()
 	else
 		return 0
 	fi
+
+	squid_configtest
 }
 
 squid_reload()
@@ -113,6 +118,18 @@ squid_reload()
 	$command $required_args $squid_flags -k reconfigure
 }
 
+squid_configtest()
+{
+
+	echo "Performing sanity check on ${name} configuration."
+	if $command $required_args $squid_flags -k check; then
+		echo "Configuration for ${name} passes."
+		return 0
+	else
+		return $?
+	fi
+}
+
 squid_getpid()
 {
 	# retrieve the PID of the Squid master process explicitly here


More information about the svn-ports-all mailing list