I want to run the script sikkerhetskopiering.sh that copies the data from Node-RED, Home Assistant and a few other things, from an exec node (impossible directly because I have Node-RED in a Docker container, and I want to run it on the Docker host). Normally that should be quite easy:
The StricktHostKeyChecking is necessary to run shell scripts, it seems.
The problem is that the script stops Node-RED (which it's supposed to do) and then stops executing, which it's not supposed to do. This should contain the necessary parts, but I can't get it to work.
Thanks for answering! Here's the script. I know it stops executing before the date for the backup is created, because that doesn't happen, so stopping Docker (and in that way stopping Node-RED) is the last thing that actually happens:
No, as I say, it's run with a SSH login to the host, so Node-RED does not directly run this script. nohup (no hang up) means that after Node-RED has started the script on the Docker host and logged off the SSH session, the script should still go on, if I have not misunderstood what I've found on the web. If I'm mistaken, maybe the nohup should be in the script?
Is 192.168.1.101 the same machine that the node red with the exec node is running on? So you are using ssh to communicate with the host machine of the docker container?
I don't know nearly enough about docker to give useful advice but if the script terminates when docker goes down does that mean you are sshing into the container?
Is it possible to connect to the host operating system and restart docker from there?
No, I'm SSHing out of the container to the host to run the script there. The script, if I can get it to run when Node-RED goes down, starts Docker and then the containers again when the backup is done.