This is the development version of Kanrisuru. Since this is still a pre-1.0 release, we don't recommend using this in system-critical production environments.

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