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?
It’s not so much that it doesn’t support the Exec bindings but that the Exec binding isn’t all that useful.
The whole purpose of a container is to provide everything that a single program needs to run in one package. In some ways, you can look at a container as a wholly separately running operating system.
But, the container also only includes just what the program running inside it needs to run. There are no extras available, like Python. Some containers don’t even have bash. So most of the …
Edit:
The best “way” is that one that does not need any more tools and not more work then necessary.
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 ?
For example please octopi shutdown my NAS or similiar ?
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?
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
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
I wrote python since I am comfortable with python.