Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Apr 2020 17:26:35 +0000 (UTC)
From:      Matthias Andree <mandree@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r530693 - in head/net-mgmt/netdata: . files
Message-ID:  <202004041726.034HQZe5019610@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mandree
Date: Sat Apr  4 17:26:35 2020
New Revision: 530693
URL: https://svnweb.freebsd.org/changeset/ports/530693

Log:
  net-mgmt/netdata: rc script fixes for borderline cases, and use err[1]/warn.
  
  PR:		235006
  Reported by:	Mateusz Piotrowski (0mp@) [1]

Modified:
  head/net-mgmt/netdata/Makefile
  head/net-mgmt/netdata/files/netdata.in

Modified: head/net-mgmt/netdata/Makefile
==============================================================================
--- head/net-mgmt/netdata/Makefile	Sat Apr  4 17:17:55 2020	(r530692)
+++ head/net-mgmt/netdata/Makefile	Sat Apr  4 17:26:35 2020	(r530693)
@@ -3,7 +3,7 @@
 
 PORTNAME=	netdata
 PORTVERSION=	1.20.0
-PORTREVISION=	2
+PORTREVISION=	3
 DISTVERSIONPREFIX=	v
 CATEGORIES=	net-mgmt
 

Modified: head/net-mgmt/netdata/files/netdata.in
==============================================================================
--- head/net-mgmt/netdata/files/netdata.in	Sat Apr  4 17:17:55 2020	(r530692)
+++ head/net-mgmt/netdata/files/netdata.in	Sat Apr  4 17:26:35 2020	(r530693)
@@ -54,8 +54,7 @@ get_user_from_conf() {
 check_user_consistency() {
 	cfusr=$(get_user_from_conf)
 	if [ -z "$cfusr" -o "$cfusr" = "${netdata_user}" ] ; then return 0 ; fi
-	echo >&2 "$0: ERROR: ${netdata_conf} sets 'run as user = $cfusr', but rc.conf* sets '${netdata_user}'. Both must be consistent."
-	return 1
+	err 1 "${netdata_conf} sets 'run as user = $cfusr', but rc.conf* sets '${netdata_user}'. Both must be consistent."
 }
 
 # this is more or less a copy of /etc/rc.subr from 12.1-RELEASE
@@ -69,17 +68,16 @@ stop_cmd() {
 		return 1
 	fi
 	_prefix=
-	slave_pids=$(pgrep -P $rc_pid)
 	echo "Stopping ${name}."
-	_list="$rc_pid $slave_pids"
+	_list="$rc_pid $(pgrep -P $rc_pid)"
 	kill -TERM $_list
-	wtim=0
+	pwait -t 3 $_list 2>/dev/null
+	wtim=3
 	while :; do
 		_nlist=
 		for _j in $_list ; do
 			if kill -0 $_j 2>/dev/null ; then
-				_nlist="$_nlist $_j"
-				[ -n "$_prefix" ] && sleep 1
+				_nlist="$_nlist${_nlist:+" "}$_j"
 			fi
 		done
 		if [ -z "$_nlist" ] ; then
@@ -88,12 +86,17 @@ stop_cmd() {
 		_list=$_nlist
 		echo -n ${_prefix:-"Waiting for PIDS: "}$_list
 		_prefix=", "
+		sleep 1
 		pwait -t 2 $_list 2>/dev/null
-		wtim=$(($wtim + 3))
-		if [ $wtim -gt ${netdata_stop_maxwait} ] ; then
-			echo -n "${_prefix}SIGKILL $_list"
-			kill -KILL $_list
-			break
+		if [ $? -eq 124 ] ; then
+			wtim=$(($wtim + 3))
+			if [ $wtim -ge ${netdata_stop_maxwait} ] ; then
+				[ -n "$_prefix" ] && echo .
+				_prefix=
+				warn "${procname} has not terminated in ${netdata_stop_maxwait} s. Using SIGKILL $_list."
+				kill -KILL $_list
+				break
+			fi
 		fi
 	done
 	[ -n "$_prefix" ] && echo .



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004041726.034HQZe5019610>