Kanrisuru

poweroff

Poweroff a 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.poweroff(time: '11:11', message: 'This server is being turned off.')
result.success?
true

Parameters

Field Type Description
time string
integer
Either an integer (in minutes) or a string in the format of "HH:MM", or "now" that sets when the system should be rebooted.
cancel boolean
Cancel an already scheduled reboot.
message string
Write to all logged in users about the rebooting server.
no_wall boolean
Do not send wall message before reboot.

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

Tested On

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