Reboot from Docker

  • Platform information:
    • Hardware: CPUArchitecture/RAM/storage Pi 3B+
    • OS: what OS is used and which version Docker
    • Java Runtime Environment: which java platform is used and what version Docker
    • openHAB version: 2.4.0
  • Issue of the topic: please be detailed explaining your issue

Hi, I try to build a swich for openhab-docker to reboot the host system…for that, I wanted the switch to write the value 1 into a docker mounted volume (host can also read). A cronscript on the host than checks, if the one is present…when it is so, the host reboots. How is the format of the command I have to input in the exec binding? because echo “1” /openhab/scripts/reboot.trigger doesn’t seem to work…Any Ideas?

echo "1" > /openhab/scripts/reboot.trigger

would be more apropriate.

In close to 100% of cases there’s no need for a reboot and certainly not for a SW switch for this.
This question keeps appearing over and over but it’s always an instance of the XY problem:
the poster lazily wants to reboot OH instead of investigating his problem to find a proper solution.
Sorry for refusing to help with that.

1 Like

Yes thanks had a typo in the description…I tried it as you suggested but doesn’t help…

echo seems not to work …

Perhaps you try it like this

rule"Set Reboot Trigger"
  Item Reboot changed to ON
  executeCommandLine("touch /openhab/conf/scripts/reboot.trigger")

if [ -f /volume1/docker/openhab/conf/scripts/reboot.trigger ]; then
  rm /volume1/docker/openhab/conf/scripts/reboot.trigger
  sudo reboot

Your host system will not look for the 1 in the reboot.trigger, your host will have to check if the file exists.

Thanks I will try this tomorrow :slight_smile:

1 Like

Can you describe how the Item would be setup without a thing, to only trigger this rule? cause it is not shown in the control section if not connected to a thing…

In PaperUI Controll Section only Item’s with Things …

To show Items in BasicUI and Smartphone App you must edit your Sitemap.

Switch item=Reboot label="Reboot" //Switchable

Text item=Reboot label="Reboot"  //Not Switchable, only shows Status

Hi =) I completely forgot on the issue sorry…but the solution @ei_Gelb_Geek works perfectly for touching the reboot.trigger! With the basch script and a cron job on the host for every five minutes to execute it, the reboot should work perfectly =) GREAT THANKS =)

1 Like