Kanrisuru

nproc

Get number of processing units available on a remote server in ruby.
linux manual

Basic Usage

require 'kanrisuru'
host = Kanrisuru::Remote::Host.new(host: '127.0.1.1', username: 'ubuntu', keys: ['~/.ssh/id_rsa'])

result = host.nproc
result.success?
true

result.to_i
2

Parameters

Field Type Description
all boolean
Get the number of installed processors

Result

Returns the number of processesors as an integer.

Exit Status

Code Description
0 Success
1 Failure

Tested On

  • Ubuntu, Debian, Centos, Fedora, Redhat, OpenSuse, SLES