svn commit: r433676 - in head/net-mgmt/unifi5: . files
Mark Felder
feld at FreeBSD.org
Wed Feb 8 21:49:21 UTC 2017
Author: feld
Date: Wed Feb 8 21:49:19 2017
New Revision: 433676
URL: https://svnweb.freebsd.org/changeset/ports/433676
Log:
net-mgmt/unifi5: Clean up child processes
Unifi starts up its own mongodb child process automatically. It does
this regardless of any existing mongodb process running on the system.
If you attempt to restart unifi without stopping its mongodb process it
will attempt to start mongodb processes for eternity, filling your logs.
This situation is regularly encountered by users updating to the newest
release.
There is no workaround but to signal any remaining processes owned by
the unifi user at shutdown. The included change takes note of any child
PIDs before starting shutdown and signals them after the unifi process
has been stopped successfully.
Reported by: dvl
Modified:
head/net-mgmt/unifi5/Makefile
head/net-mgmt/unifi5/files/unifi.in
Modified: head/net-mgmt/unifi5/Makefile
==============================================================================
--- head/net-mgmt/unifi5/Makefile Wed Feb 8 21:24:57 2017 (r433675)
+++ head/net-mgmt/unifi5/Makefile Wed Feb 8 21:49:19 2017 (r433676)
@@ -3,7 +3,7 @@
PORTNAME= unifi5
PORTVERSION= 5.4.11
-PORTREVISION= 0
+PORTREVISION= 1
CATEGORIES= net-mgmt java
MASTER_SITES= https://www.ubnt.com/downloads/unifi/${PORTVERSION}-${UNIFI_TAG}/ \
LOCAL/feld/${PORTNAME}-${PORTVERSION}/
Modified: head/net-mgmt/unifi5/files/unifi.in
==============================================================================
--- head/net-mgmt/unifi5/files/unifi.in Wed Feb 8 21:24:57 2017 (r433675)
+++ head/net-mgmt/unifi5/files/unifi.in Wed Feb 8 21:49:19 2017 (r433676)
@@ -30,6 +30,8 @@ procname=%%JAVA%%
command="/usr/sbin/daemon"
command_args="-f -p ${pidfile} %%JAVA%% ${unifi_javaflags} -jar lib/ace.jar start"
start_precmd=start_precmd
+stop_precmd=stop_precmd
+stop_postcmd=stop_postcmd
start_precmd()
{
@@ -38,4 +40,21 @@ start_precmd()
fi
}
+stop_precmd()
+{
+ if [ -r ${pidfile} ]; then
+ _UNIFIPID=$(check_pidfile ${pidfile} ${procname})
+ export _UNIFI_CHILDREN=$(pgrep -P ${_UNIFIPID})
+ fi
+}
+
+stop_postcmd()
+{
+ if ! [ -z ${_UNIFI_CHILDREN} ]; then
+ echo "Cleaning up leftover child processes."
+ kill $sig_stop ${_UNIFI_CHILDREN}
+ wait_for_pids ${_UNIFI_CHILDREN}
+ fi
+}
+
run_rc_command "$1"
More information about the svn-ports-head
mailing list