- Platform information:
- Hardware: Intel 64bit
- OS: Debian 10
- Java Runtime Environment: unknown (prepackaged with Docker image)
- openHAB version: 2.5.7
- Issue of the topic: Trying to create a Thing/Item switch that will send the command to restart the OH Docker container
- Please post configurations (if applicable):
- Items configuration related to the issue
exec:command:OHRestart [command="docker restart openhab", interval=0, timeout=25]
Switch OHRestart "Restart OH Container" {channel="exec:command:OHRestart:run"}
String OHOutput "OHRestart Output" {channel="exec:command:OHRestart:output"}
-
Sitemap configuration related to the issue
-
Rules code related to the issue
-
Services configuration related to the issue
Exec whitelist IS updated to include “docker restart openhab”
I have also installed Docker within Docker -
If logs where generated please post these here using code fences:
I run OH via Docker from the official Docker image (openhab/openhab:latest). Every once in a while, some of my devices will disconnect (WeMo, mainly), and I can fix the system by simply restarting the container. I would like to create an Exec switch in OH that will send the restart command so that I don’t have to go to my computer, ssh into my machine, and restart from there.
I have installed Docker within Docker such that, if I run the command “docker restart openhab” from within the container (via docker exec or Portainer), the restart works flawlessly.
I have also created a Thing and Item in OH that seems to trigger fine (no log errors or warnings) to execute the same “docker restart openhab” script, but it doesn’t seem to actually execute the command. I even created a bash script to execute the same thing, and that didn’t help.
Any ideas?
Thanks.