Author Topic: Is there luup code for sending ssh commands to a server?  (Read 20738 times)

Offline mda

  • Sr. Member
  • ****
  • Posts: 464
  • Karma: +9/-0
Is there luup code for sending ssh commands to a server?
« Reply #75 on: April 06, 2017, 11:34:30 am »
is there a better way??

I'm not sure if it is better (someone smarter like RTS would need to weigh in), but I use ncat on the remote host to make it listen and run a command when it receives traffic on a specific port, then I use wget on the vera (with a short timeout) to make the URL call to the remote server to trigger it.

I realize it is insecure but it is all within my LAN and only for low risk functions (like turning off a Mac's display at night and turning on the HVAC in my car).

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 9368
  • Karma: +704/-129
    • RTS Services Plugins
Re: Is there luup code for sending ssh commands to a server?
« Reply #76 on: April 08, 2017, 07:25:41 pm »
I can't answer that question without knowing the details of he network between Vera and where you are sending the ssh command to.
Is the device guaranteed to be available and responsive 100.00 % of the time ?
Will the device always respond within a couple of seconds ? 
Is the network between  guaranteed to be up  and responsive 100.00 % of the time ?
Will the network allow Vera to connect to the device within a couple of seconds ?

If the answer to any of this can occasionally be false, this solution can cause Vera to restrart.

There are many different ways to solve this depending on your programming skills in LUA (where you put timeouts on connections and responses) or in shell scripts ... where you return right away but allow a sub process to do the communications in the background).

Offline trouty00

  • Full Member
  • ***
  • Posts: 206
  • Karma: +2/-1
Re: Is there luup code for sending ssh commands to a server?
« Reply #77 on: April 12, 2017, 08:45:13 am »
Yes/maybe not to all questions unless I have a bigger issue going on in which case a vera restart is least of my problems.

although the SSH code is set to have a 30 second delay in it which is maybe causing issues as the SSH code isnt completing.

I can't answer that question without knowing the details of he network between Vera and where you are sending the ssh command to.
Is the device guaranteed to be available and responsive 100.00 % of the time ? YES
Will the device always respond within a couple of seconds ?  possibly not if a response isnt provided until script complete.
Is the network between  guaranteed to be up  and responsive 100.00 % of the time ? YES
Will the network allow Vera to connect to the device within a couple of seconds ? YES

If the answer to any of this can occasionally be false, this solution can cause Vera to restrart.

There are many different ways to solve this depending on your programming skills in LUA (where you put timeouts on connections and responses) or in shell scripts ... where you return right away but allow a sub process to do the communications in the background).

« Last Edit: April 12, 2017, 10:01:52 am by trouty00 »