Method: Unix::Exec#ssh_service_restart

Defined in:
lib/beaker/host/unix/exec.rb

#ssh_service_restartResult

Restarts the SSH service.

Returns:

  • (Result)

    result of restarting the SSH service



279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/beaker/host/unix/exec.rb', line 279

def ssh_service_restart
  case self['platform']
  when /debian|ubuntu/
    exec(Beaker::Command.new("systemctl restart ssh"))
  when /(el|centos|redhat|oracle|scientific)-[0-6]\b/
    exec(Beaker::Command.new("/sbin/service sshd restart"))
  when /solaris/
    exec(Beaker::Command.new("svcadm restart svc:/network/ssh:default"))
  when /(free|open)bsd/
    exec(Beaker::Command.new("sudo /etc/rc.d/sshd restart"))
  when /opensuse|sles/
    exec(Beaker::Command.new("/usr/sbin/rcsshd restart"))
  else
    exec(Beaker::Command.new("systemctl restart sshd.service"))
  end
end