diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-12-01 06:15:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-12-01 06:15:04 +0000 |
commit | e970e0b37b8bd7f246feb3f70c4136418225e434 (patch) | |
tree | 0b67c0ca45f56f2f9d9c5c2e725279ecdf52d2eb /packaging/installer/functions.sh | |
parent | Adding upstream version 1.31.0. (diff) | |
download | netdata-e970e0b37b8bd7f246feb3f70c4136418225e434.tar.xz netdata-e970e0b37b8bd7f246feb3f70c4136418225e434.zip |
Adding upstream version 1.32.0.upstream/1.32.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/installer/functions.sh')
-rw-r--r-- | packaging/installer/functions.sh | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/packaging/installer/functions.sh b/packaging/installer/functions.sh index fd10fcfaf..6264c1131 100644 --- a/packaging/installer/functions.sh +++ b/packaging/installer/functions.sh @@ -224,17 +224,22 @@ safe_pidof() { # ----------------------------------------------------------------------------- find_processors() { - # Most UNIX systems have `nproc` as part of their userland (including macOS, Linux and BSD) + # Most UNIX systems have `nproc` as part of their userland (including Linux and BSD) if command -v nproc > /dev/null; then nproc && return fi + # macOS has no nproc but it may have gnproc installed from Homebrew or from Macports. + if command -v gnproc > /dev/null; then + gnproc && return + fi + local cpus if [ -f "/proc/cpuinfo" ]; then # linux cpus=$(grep -c ^processor /proc/cpuinfo) else - # freebsd + # freebsd cpus=$(sysctl hw.ncpu 2> /dev/null | grep ^hw.ncpu | cut -d ' ' -f 2) fi if [ -z "${cpus}" ] || [ $((cpus)) -lt 1 ]; then |