Edit the sudoers file and enable sudoing like described above.
Cmnd_Alias SHUTDOWN_CMDS = /bin/systemctl restart openhab2.service
openhab ALL=(ALL) NOPASSWD: SHUTDOWN_CMDS
you need the absolut path and it should work.
Thing exec:command:openhab_restart [command=“sudo /bin/systemctl restart openhab2.service”, interval=0, autorun=true]