summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormorr <morr@pkgsrc.org>2016-02-16 21:59:45 +0000
committermorr <morr@pkgsrc.org>2016-02-16 21:59:45 +0000
commitde09a5225135900da9b4ac352cfca20b0ee4a2a3 (patch)
tree45c29e02f8cf50a275ee28e99e0314ebbade7f3c
parent9bbc0e2f38cf54681673783d86a84a18ee28cf9a (diff)
downloadpkgsrc-de09a5225135900da9b4ac352cfca20b0ee4a2a3.tar.gz
Add fd limits to startup script. Bump PKGREVISION.
-rw-r--r--net/haproxy/Makefile3
-rw-r--r--net/haproxy/files/haproxy.sh15
2 files changed, 16 insertions, 2 deletions
diff --git a/net/haproxy/Makefile b/net/haproxy/Makefile
index c79a19040a4..a78d9fcc84a 100644
--- a/net/haproxy/Makefile
+++ b/net/haproxy/Makefile
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.23 2016/01/03 17:13:40 morr Exp $
+# $NetBSD: Makefile,v 1.24 2016/02/16 21:59:45 morr Exp $
DISTNAME= haproxy-1.6.3
+PKGREVISION= 1
CATEGORIES= net www
MASTER_SITES= http://www.haproxy.org/download/1.6/src/
diff --git a/net/haproxy/files/haproxy.sh b/net/haproxy/files/haproxy.sh
index 4c0481ce77b..3e3081fe21f 100644
--- a/net/haproxy/files/haproxy.sh
+++ b/net/haproxy/files/haproxy.sh
@@ -1,6 +1,6 @@
#!@RCD_SCRIPTS_SHELL@
#
-# $NetBSD: haproxy.sh,v 1.2 2014/04/27 01:28:01 rodent Exp $
+# $NetBSD: haproxy.sh,v 1.3 2016/02/16 21:59:45 morr Exp $
#
# PROVIDE: haproxy
@@ -16,6 +16,7 @@ required_files="${conf_file}"
command_args="-f ${conf_file}"
extra_commands="configtest"
configtest_cmd="haproxy_configtest"
+haproxy_fdlimit=${haproxy_fdlimit-"1024"}
haproxy_configtest()
{
@@ -26,5 +27,17 @@ haproxy_configtest()
${command} -c -f ${conf_file}
}
+# A default limit of 64 (at least on NetBSD) may be too low for many people
+SOFT_FDLIMIT=`ulimit -S -n`
+HARD_FDLIMIT=`ulimit -H -n`
+
+if [ ${haproxy_fdlimit} -gt ${SOFT_FDLIMIT} ]; then
+ if [ ${haproxy_fdlimit} -le ${HARD_FDLIMIT} ]; then
+ ulimit -S -n ${haproxy_fdlimit}
+ else
+ ulimit -S -n ${HARD_FDLIMIT}
+ fi
+fi
+
load_rc_config $name
run_rc_command "$1"