aboutsummaryrefslogtreecommitdiffstats
path: root/www
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2015-10-01 02:58:04 +0800
committerbdrewery <bdrewery@FreeBSD.org>2015-10-01 02:58:04 +0800
commit075a8bf75ec444f606a328d139d19a9567cccd2d (patch)
tree7370aa2a588dc43d8996ec757ec022c5ed6dd6e1 /www
parent5cd36af6ea6571db45d7f1686b2c024922528921 (diff)
downloadfreebsd-ports-gnome-075a8bf75ec444f606a328d139d19a9567cccd2d.tar.gz
freebsd-ports-gnome-075a8bf75ec444f606a328d139d19a9567cccd2d.tar.zst
freebsd-ports-gnome-075a8bf75ec444f606a328d139d19a9567cccd2d.zip
rc.d/squid: Check the config before starting, reloading, or restarting.
Diffstat (limited to 'www')
-rw-r--r--www/squid/Makefile1
-rw-r--r--www/squid/files/squid.in19
2 files changed, 19 insertions, 1 deletions
diff --git a/www/squid/Makefile b/www/squid/Makefile
index 689f237cca89..10961cddc7a0 100644
--- a/www/squid/Makefile
+++ b/www/squid/Makefile
@@ -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}/ \
diff --git a/www/squid/files/squid.in b/www/squid/files/squid.in
index c5843df89201..3af085ab0845 100644
--- a/www/squid/files/squid.in
+++ b/www/squid/files/squid.in
@@ -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