How to execute a command from my rules file?

(Augis) #1

Hello, so I need to execute a command

sudo reboot

in my rules file so here is what I’m working with

rule "raspi reboot"
when 
Item raspirr received update
then
//Right here i need to execute "sudo reboot"
end

Any help will be highly appreciated. :slight_smile:

0 Likes

(TonyC) #2

Would the EXEC binding work here?

Check out this thread

0 Likes

(Augis) #3

Could you give me a detailed guide how to use it? I’m new with the Exec Binding
And I would rather prefer doing it in the rules something like executeCommandLine(“sudo reboot”)

0 Likes

(Rich Koshak) #4

So have you actually tried doing that?

http://docs.openhab.org/addons/bindings/exec/readme.html

With either approach, when you encounter problems:

1 Like

(Augis) #5

Yes, I have and I also tried doing this


didn’t seem to work.

0 Likes