I have openhab 2.2.4, and sometime I need to automate the restarting of a Bundle that hang.
I tried this command:
sshpass -p ‘habopen’ ssh openhab@localhost -p8101 ‘bundle:stop 221’
The command do not return a results, and bunlde do not stop.
Is there a way to make it work, or automate the restarting of a bundle from bash?
From the openhab2 directory, try this:
./runtime/bin/client -p habopen "bundle:stop 221"
it works as root, but do not work as another user. I restart bundle using Zabbix monitoring system, and zabbix-agent run with non root admin.
I solved using sshpass, I have to login as zabbix user and then login via ssh console one time from command line in order to exchange ssh key and fingerprint. after this sshpass is able to automate login and restar bundle.
Many thaks for your suggetion, i keep in mind for the future.
@marcolino7 you could give sudo rights for that command to the needed user. Then execute with sshpass I believe. Sudo rights with no password to be clear. I believ this would work.
Look in forum for visudo.
You can configure the Karaf console to use an ssh cert instead of a password. This link has some instructions for where to put the keys. This would allow OH to login without password at all.