How to restart binding with in rules?

So, this can be done but it will require some config on your part.

Firstly, you need follow these instructions (scroll down to Managing authentication by key), the folder is userdata/etc/keys.properties, to configure karaf to use ssh certs for authentication and make sure the openhab user is configured to use those certs. This will make it so you don’t have to enter a password for the openhab user to ssh into the karaf console.

Then you can issue the following command through executeCommandLine or the Exec binding:

ssh -p 8101 openhab@localhost 'bundle:restart 208, 211'

There are other approaches you can take with sshpass but you really should use the ssh keys instead.

2 Likes