Rule DSL behaving differently when called as an action from a cell in the UI

  • Platform information:
    • Hardware: Raspberry pi 4
    • OS: Openhabian
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version: OH3.4

Introduction
I am using OH 3.4 installed with openhabian on a raspeberry pi v4 4Gb,
together with some other external services such as HABApp, mosquitto, TheengsGateway, tuya.
Periodically (typically after few weeks but not systematically) the system stops working properly until I reboot: maybe there’s a memory leak somewhere. I am trying to figure out where the trouble is, meanwhile, as this is the production system, I am also implementing a way to make rebooting simpler.

The Problem
Instead of logging through ssh and manually issuing the commands, I have implemented a rule to reboot, following advice found in this and this thread.
The problem I have is that the rule do not run properly when called as an action from a cell in the overview page, while it works when I run it manually.
Are there any suggestions to make it run from the overview page? Should I try with some other rule language?

The details
The bash script is the following

#!/bin/bash
sudo systemctl stop zram-config.service
sudo systemctl stop habapp.service
sudo /usr/sbin/reboot

the reason for stopping zram is to ensure that persistence is recorded on the SD card, as it happened (very very rarely, but it is still annoying) that it was lost after a reboot.
All permissions are set correctly as I verified by issuing the command

sudo -u openhab ./srv/openhab-conf/reboot.sh 

I have implemented through UI a rule DSL, which calls the previous script

configuration: {}
triggers: []
conditions: []
actions:
  - inputs: {}
    id: "1"
    configuration:
      type: application/vnd.openhab.dsl.rule
      script: >-
        logInfo("Flag_System", "Rebooting openHAB")
        RebootOpenHAB_Message.sendCommand("Reboot sent")
        executeCommandLine(Duration.ofSeconds(60),"/srv/openhab-conf/scripts/openhab_reboot.sh")
    type: script.ScriptAction

If I test the rule by running it manually through the UI, the reboot is performed.

Finally, I created a simple cell on the overview page, in order to call the rule,
but the final result is that openhab is restarted, zram-config is stopped but the reboot does not occur

component: oh-cell
config:
  action: rule
  actionRule: RebootOpenHAB
  header: ='UpTime:'+items.Raspi_3_OH34_System_Uptime.state
  on: "=items.RebootOpenHAB_Message.state == 'Click to reboot' ? false : true"
  subtitle: =items.RebootOpenHAB_Message.state
  title: Reboot Cell