Exec Command Binding Shutdown NAS from Docker Container?

Hi,

my OH2 running in a Docker Container. I want to shutdown my NAS with exec binding without password.

The Host has SSH Key for my NAS so executing a shutdown of the NAS from Host should be possible.

First consideration is either that the container gets an ssh key and shutdown the NAS on its own.

Second consideration would be that the container triggers the shutdown command on the host that has the key anyway.

What is the best way to do this?

:mage:

Edit:
The best “way” is that one that does not need any more tools and not more work then necessary. :slight_smile:
First thing I noticed is that the openHAB docker container does not have SSH.

I understand - but OpenHab can also start stop on off everything else. So why is it not possible to say any device in my home please shutdown my NAS :slight_smile: ?

For example please octopi shutdown my NAS or similiar :slight_smile: ?

Hmmmm.

My approach would be a python script running on Host XYZ which holds the ssh-key to the NAS.
This python script would listen to a MQTT Topic example cmnd/NAS/shutdown and would then do the logic.

Hhm also a posability is to install on the docker HOST node red with MQTT node and an exec node ?

Uhmm and how does node-red access your NAS via SSH if it’s not present? :thinking:

I assume you shutdown your NAS via an SSH command like, something like that?

ssh root@my-nas shutdown -h now
ssh root@mynas reboot

correct - and a good question :smiley:

how looks like your opinion ? Im not familiar with python stuff

Python is just an option. If you are familiar with a different language then use that one :slight_smile:
I wrote python since I am comfortable with python.