On Wed, 30 Oct 2024 at 16:20, Steffen Nurpmeso via austin-group-l at
The Open Group <[email protected]> wrote:
> elif command -v kstat >/dev/null 2>&1; then
> i=$(PERL5OPT= kstat -p cpu | awk '
> BEGIN{no=0; FS=":"}
> {if($2 > no) max = $2; next}
> END{print ++max}
> ')
> [ $? -eq 0 ] && NPROC=$i
> fi
> export NPROC
FWIW, you can just use "psrinfo -t" (for "totals") if you want the
online CPU count, at least on illumos systems:
$ uname -a
SunOS vulcan 5.11 helios-2.0.22694 i86pc i386 i86pc
$ PERL5OPT= kstat -p cpu | awk 'BEGIN { no = 0; FS = ":"; }
{ if ($2 > no) max = $2; next; }
END{ print ++max; }'
48
$ psrinfo -t
48
Cheers.
--
Joshua M. Clulow
http://blog.sysmgr.org