Date: Wed, 8 Feb 2017 21:49:19 +0000 (UTC) From: Mark Felder <feld@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r433676 - in head/net-mgmt/unifi5: . files Message-ID: <201702082149.v18LnJ6K081404@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702082149.v18LnJ6K081404>