kill
Kill a process or set of processes 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'])
pid = host.ps(user: 'ubuntu')[0].pid
result = host.kill(9, pid)
result.success?
true
Parameters
| Field | Type | Description |
|---|---|---|
| signal |
integer
string
|
What signal to send to the process or process groups. Can either be a number or a singal name. See signal for a full list of signals. |
| pid |
integer
array
|
The process id, or array of process ids to send signal to. |
Result
No explicit data struct returned, only option is success?, failure?, and status to see if the program exited properly.
Exit Status
| Code | Description |
|---|---|
| 0 | Success |
| 1 | Failure |
| 64 | Partial success (when more than one process specified) |
Tested On
- Ubuntu, Debian, Centos, Fedora, Redhat, OpenSuse, SLES