So have you actually tried doing that?
http://docs.openhab.org/addons/bindings/exec/readme.html
With either approach, when you encounter problems: