this has been bugging me for ages; nut works fine if started from
a shell, but from rc.local upsd dies. I finally got annoyed with it
enough to track it down, turns out if sysconf reports a fewer number
of filehandles available than the setting of MAXCONN (which defaults
to FD_SETSIZE, 1024) it dies.
we could get fancy and use setrlimit to bump the value, but I think
this simpler diff is enough; it just changes the default config file
to a value that works with our standard login.conf and adds a few
notes. ok?
Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/nut/Makefile,v
retrieving revision 1.32
diff -u -p -r1.32 Makefile
--- Makefile 15 Sep 2009 17:37:22 -0000 1.32
+++ Makefile 12 Jan 2010 10:57:34 -0000
@@ -5,7 +5,7 @@ COMMENT-cgi= CGIs for monitoring Nut-ba
COMMENT-snmp= driver for monitoring UPSs via SNMP
DISTNAME= nut-2.4.1
-PKGNAME-main= ${DISTNAME}p0
+PKGNAME-main= ${DISTNAME}p1
PKGNAME-cgi= ${DISTNAME:S/-/-cgi-/}p0
PKGNAME-snmp= ${DISTNAME:S/-/-snmp-/}p0
CATEGORIES= sysutils
Index: patches/patch-conf_upsd_conf_sample
===================================================================
RCS file: patches/patch-conf_upsd_conf_sample
diff -N patches/patch-conf_upsd_conf_sample
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-conf_upsd_conf_sample 12 Jan 2010 10:57:34 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+--- conf/upsd.conf.sample.orig Tue Jan 12 10:37:38 2010
++++ conf/upsd.conf.sample Tue Jan 12 10:45:34 2010
+@@ -39,3 +39,10 @@
+ # This defaults to 1024 connections. Each UPS, each LISTEN address and each
+ # client count as one connection. If the server runs out of connections, it
+ # will no longer accept new incoming client connections.
++#
++MAXCONN 128
++#
++# System resource restrictions must permit MAXCONN file handles to be
++# opened otherwise upsd will fail to start. To allow more, use ulimit -n,
++# or change the openfiles-cur value in login.conf (for the 'daemon' class
++# if started from rc.local).