net-mgmt/netdata rc script overhaul, fix termination, user config
This script overhaul does the following:
- Read "run as user" from the netdata configuration file, and use that to override the default user "netdata", in case it is not set in /etc/rc.conf* and friends.
- Kill all children of the PID in the netdata_pid file, too, because 1.20.0 would leave some plugin processing lingering.
- Timeout the termination after (configurable) 30 seconds and issue SIGKILL
- Cleanup the netdata_pid file after stop, so that a subsequent start with a less privileged user (say, start as root, stop, start as netdata) will work properly.
- Document all variables, including the all-new netdata_stop_maxwait, in the header of the script.
- Quote parameter expansions where appropriate.
PR: 235006
Reported by: Dries Michiels <driesm.michiels@gmail.com>
Reviewed by: Dries Michiels <driesm.michiels@gmail.com>
Approved by: maintainer timeout (mmohki@, ~ 1 year)