ECMAScript (ECMA - 262 Edition 5.1) do not work

Hello everyone,

I’m new to openhab and I have an error that I comment on because I can’t find the solution.
After the system worked fine and after some problems I had to recover the backup of the instance through openhab-cli.
Once the instance is started, the scripts that were already created with ECMAScript (ECMA - 262 Edition 5.1) do not work.

configuration: {}
triggers:
  - id: "1"
    configuration:
      command: OFF
      itemName: rebootSystem
    type: core.ItemCommandTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      blockSource: <xml xmlns="https://developers.google.com/blockly/xml"><block
        type="oh_script_inline" id=".6v/ADAi:,hEGp0D18i}" x="16" y="445"><field
        name="inlineScript">Java.type("org.openhab.core.model.script.actions.Exec").executeCommandLine("sudo","reboot")</field></block></xml>
      type: application/javascript
      script: >
        Java.type("org.openhab.core.model.script.actions.Exec").executeCommandLine("sudo","reboot")
    type: script.ScriptAction

The first problem I found was the duplicates bundle automation addons, I fixed this with:
• sudo /bin/systemctl stop openhab.service
• sudo openhab-cli clean-cache
• sudo /bin/systemctl start openhab.service
Duplicate addons disappeared. Uninstall JavaScript Scripting and reinstall but the rules still don’t work.
The log does not indicate any errors.

Any help is welcome, thanks

I cant say anything specific to your script. However i did notice some changes to the functions provided by the openhab libraries. So you kinda have to rework the scripts.

I have found the solution in this post:
OpenHAB sudo [Exec Binding]

Thank you

Why do you need a rule to reboot your openHAB server ? This should not be necessary.

True, it shouldn’t be necessary, but it is a system in a public space and it has to be dismantled every day. It was thought convenient to create the system shutdown function so that the administrator can do it from the UI. The reboot one was also created in case it was necessary.

This sounds a bit strange an not ideal, but explains the need. You should find a way this should not be needed.

Thank you for your observations, I will take it into consideration.
greetings