Somebodey can help me with shutting down linux machine.
I run openhab server on win7 and trying to shutdown debian machine with this binding exec=“OFF:ssh email@example.com shutdown -p now” but not work
[ERROR] [.o.b.exec.internal.ExecBinding] - couldn’t execute commandLine ‘ssh firstname.lastname@example.org shutdown -p now’
java.io.IOException: Cannot run program “ssh”: CreateProcess error=2, The system cannot find the file specified
may be this is linux command and cannot bre runned on win machine
Windows does not have a native ssh client. I’m pretty sure Putty comes with a command line utility called plink that is very similar to the native ssh client found on linux machines.
I know this program but I don’t know how can I use it for this binding.
In windows I use exec binding to execute exe files… I compile exe files from bat files because bat files causing me problems. I don’t have any idea what kind of code have to write. I reade a lot of information in Google but can’t find example code for my case.
with Putty installed, as Joshua recommended, you can use plink as command line tool.
I didn’t test ist, but it could look like:
plink.exe -ssh -l username -pw password 192.168.1.101 shutdown -p now
It’s recommended to connect manually for the first time to check the host key and save it, before you connect automatically through openHAB.
Maybe have a look at http://the.earth.li/~sgtatham/putty/0.66/htmldoc/Chapter7.html#plink to get more information.
> plink.exe -ssh -l username -pw password 192.168.1.101 shutdown -p now
> plink.exe -ssh -email@example.com -pw password shutdown -p now
not works for me, opehHAB return
[INFO ] [.o.b.exec.internal.ExecBinding] - executed commandLine ‘plink.exe -ssh -firstname.lastname@example.org -pw password shutdown -p now’
the command is executed but no login on remote machine… on the remote machine i have a way to view last login and no login from openhab, the username, password and IP adress are correct i checked them twice. Here in this post username and password are replaced for security reason.
Did you ever have any luck with this? I have actually been fiddling with this today as ive been thinking of moving OpenHAB to my desktop windows PC and off of my raspberry pi as it’s somewhat unstable on there, but ive been having this exact issue where Karaf says it’s executed the command, but nothing happens.