-
-
Save kgrvamsi/d3d313e2f7f8bdda3429 to your computer and use it in GitHub Desktop.
Number of CPUs with getconf(1)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Originally from: | |
# https://github.com/blankpage/e5UNIXBuilder/blob/master/build-akili.sh | |
# Linux and similar... | |
CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null` | |
# FreeBSD and similar... | |
[ -z "$CPUS" ] && CPUS=`getconf NPROCESSORS_ONLN` | |
# Solaris and similar... | |
[ -z "$CPUS" ] && CPUS=`ksh93 -c 'getconf NPROCESSORS_ONLN'` | |
# Give up... | |
[ -z "$CPUS" ] && CPUS=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment