diff options
author | feld <feld@FreeBSD.org> | 2017-02-09 05:49:19 +0800 |
---|---|---|
committer | feld <feld@FreeBSD.org> | 2017-02-09 05:49:19 +0800 |
commit | 4dee4a26aca36af7f4791527cf479afaf4256034 (patch) | |
tree | 9eee02579a8a062bb31df9bde0da12bd1e33d954 /net-mgmt | |
parent | bfe86245477329c336d84d598476f503c978326f (diff) | |
download | freebsd-ports-gnome-4dee4a26aca36af7f4791527cf479afaf4256034.tar.gz freebsd-ports-gnome-4dee4a26aca36af7f4791527cf479afaf4256034.tar.zst freebsd-ports-gnome-4dee4a26aca36af7f4791527cf479afaf4256034.zip |
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
Diffstat (limited to 'net-mgmt')
-rw-r--r-- | net-mgmt/unifi5/Makefile | 2 | ||||
-rw-r--r-- | net-mgmt/unifi5/files/unifi.in | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/net-mgmt/unifi5/Makefile b/net-mgmt/unifi5/Makefile index af1effa7d964..0452b461cde6 100644 --- a/net-mgmt/unifi5/Makefile +++ b/net-mgmt/unifi5/Makefile @@ -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}/ diff --git a/net-mgmt/unifi5/files/unifi.in b/net-mgmt/unifi5/files/unifi.in index ce22923e0c39..4a59ad775dba 100644 --- a/net-mgmt/unifi5/files/unifi.in +++ b/net-mgmt/unifi5/files/unifi.in @@ -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" |