Module: Harbr::SSH
- Defined in:
- lib/harbr.rb
Instance Method Summary collapse
Instance Method Details
#on_ssh ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/harbr.rb', line 27 def on_ssh command = "" command = yield command hostname = "smtp.laki.zero2one.ee" username = "root" key_path = "/Users/db/.ssh/id_rsa" # Replace with the path to your private SSH key Net::SSH.start(hostname, username, keys: [key_path]) do |ssh| ssh.exec!(command) end rescue => e puts "Error: #{e.class}" puts "backtrace: #{e.backtrace.join('\n')}" puts "Error sending notification: #{e.}" end |