Forum: Cfengine Help
Subject: Re: sys.ncpu or something?
Author: phnakarin
Link to topic: https://cfengine.com/forum/read.php?3,17088,17089#msg-17089

Is it possible to see an exact number of CPUs with this shell command?

 # /bin/grep processor /proc/cpuinfo | /usr/bin/wc -l

If so, we could use execresult() to return an output to a variable.

 vars:
  any::
   "cpu_number" string => execresult("/bin/grep processor /proc/cpuinfo | 
/usr/bin/wc -l","useshell");

 reports:
  cfengine_3::
   "$(sys.host) has $(cpu_number) CPUs.";

Cheers,
--Nakarin

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to