FreeBSD Bugzilla – Attachment 212936 Details for
Bug 235006
net-mgmt/netdata run as user not recognized in the config file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
netdata rc script overhaul checks user name consistency and kills zombie slaves
netdata-1.20.0_2.patch (text/plain), 2.46 KB, created by
Matthias Andree
on 2020-04-01 16:35:34 UTC
(
hide
)
Description:
netdata rc script overhaul checks user name consistency and kills zombie slaves
Filename:
MIME Type:
Creator:
Matthias Andree
Created:
2020-04-01 16:35:34 UTC
Size:
2.46 KB
patch
obsolete
>Index: Makefile >=================================================================== >--- Makefile (Revision 530214) >+++ Makefile (Arbeitskopie) >@@ -3,7 +3,7 @@ > > PORTNAME= netdata > PORTVERSION= 1.20.0 >-PORTREVISION= 1 >+PORTREVISION= 2 > DISTVERSIONPREFIX= v > CATEGORIES= net-mgmt > >Index: files/netdata.in >=================================================================== >--- files/netdata.in (Revision 530210) >+++ files/netdata.in (Arbeitskopie) >@@ -13,7 +13,10 @@ > # Set it to "YES" to enable netdata. > # netdata_args (str): Custom additional arguments to be passed > # to netdata (default empty). >-# >+# netdata_user (str): Custom user to run netdata as >+# (default: netdata) >+# netdata_conf (str): Custom configuration file for netdata >+# (default: %%ETCDIR%%/netdata.conf) > > . /etc/rc.subr > >@@ -23,14 +26,66 @@ > load_rc_config $name > > : ${netdata_enable="NO"} >+: ${netdata_conf="%%ETCDIR%%/${name}.conf"} > : ${netdata_user="netdata"} > : ${netdata_pid="%%NETDATA_PERST%%/${name}.pid"} > >+SED=/usr/bin/sed >+ >+check_user_consistency() { >+ # config_file rc_conf_user >+ cfusr=$($SED -n '/^\[global\]/,/^\[/{s/[[:space:]]*run as user.*=[[:space:]]*\(.*\)[[:space:]]*$/\1/p;}' "${netdata_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 >+} >+ >+stop_cmd() { >+ rc_pid=$(check_pidfile ${netdata_pid} ${procname}) >+ if [ -z "$rc_pid" ] ; then >+ [ -n "$fc_fast" ] && return 0 >+ _run_rc_notrunning >+ return 1 >+ fi >+ _prefix= >+ slave_pids=$(pgrep -P $rc_pid) >+ echo "Stopping ${name}." >+ _list="$rc_pid $slave_pids" >+ kill -TERM $_list >+ wtim=0 >+ max_wtim=60 >+ while :; do >+ _nlist= >+ for _j in $list ; do >+ if kill -0 $_j 2>/dev/null ; then >+ _nlist="$_nlist $_j" >+ [ -n "$_prefix" ] && sleep 1 >+ fi >+ done >+ if [ -z "$_nlist" ] ; then >+ break >+ fi >+ _list=$_nlist >+ echo -n ${_prefix:-"Waiting for PIDS: "}$_list >+ _prefix=", " >+ pwait -t 2 $_list 2>/dev/null >+ wtim=$(($wtim + 3)) >+ if [ $wtim -gt $max_wtim ] ; then >+ kill -KILL $_list >+ break >+ fi >+ done >+ [ -n "$_prefix" ] && echo . >+} >+ > procname="%%PREFIX%%/sbin/${name}" > command="/usr/sbin/daemon" > command_args="-c -f ${procname} -u ${netdata_user} -P ${netdata_pid} ${netdata_args}" > >-required_files="%%ETCDIR%%/${name}.conf" >+required_files="${netdata_conf}" > >+start_precmd=check_user_consistency >+ >+stop_cmd=stop_cmd >+ > run_rc_command "$1" >-
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 235006
:
212936
|
213049