Is it possible to run a script from Docker Node-RED on host that opens in a bash windo?

I am using Screen via SSH to run a backup script on the host. The tricky thing is that I want a clean backup, so I'm stopping everything including Node-RED when doing it. I would like to be able to see on VNC if the script is still running, but that means that I need Screen to run the script in a window. I have tried to search around, but I haven't found an answer to that, probably because it's not a common use. The node is like this:

    {
        "id": "eb607f0925ac4680",
        "type": "inject",
        "z": "139a05b0e07293f9",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 100,
        "y": 400,
        "wires": [
            [
                "fab1883caac56ce6"
            ]
        ]
    },
    {
        "id": "fab1883caac56ce6",
        "type": "exec",
        "z": "139a05b0e07293f9",
        "command": "sshpass -p \"SECRET_PASSWORD\" ssh pi@192.168.5.2 -o StrictHostKeyChecking=no \"screen -S sikkerhetskopiering -d -m /home/pi/sikkerhetskopiering.sh\"",
        "addpay": "",
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "Backup via Screen",
        "x": 270,
        "y": 400,
        "wires": [
            [
                "e12ed03ace973a37"
            ],
            [
                "e12ed03ace973a37"
            ],
            [
                "e12ed03ace973a37"
            ]
        ]
    },
    {
        "id": "e12ed03ace973a37",
        "type": "debug",
        "z": "139a05b0e07293f9",
        "name": "debug 23",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 460,
        "y": 400,
        "wires": []
    }
]

So the SSH command is:

sshpass -p "SECRET_PASSWORD" ssh pi@192.168.5.2 -o StrictHostKeyChecking=no "screen -S sikkerhetskopiering -d -m /home/pi/sikkerhetskopiering.sh"

Is there a way to do what I want, or is that just not possible?

If you are running screen on the remote device, you should be able to reconnect to the screen session from a different terminal. Have a look at the screen commands. Been a long time since I used it so I don't know the commands off the top of my head.

I don't know if Docker makes a difference, but regarding running commands over ssh on another device:

Can't you tell that the script is still running because the exec node has not sent a message on it's return code output?

And if you set the exec node to send output while the command is running, you can see progress messages from your script.

@TotallyInformation I have tried to find some way to do it, but it maybe over my head...

@jbudd Well, as I said, I am stopping everything with the script including Node-RED, so there is no node to receive the message.

Oh, finally found it! I can use screen -ls, which will show me the running sessions as numbers, let's say it's 92358 and then screen -r 92358 to connect to it!

But you are running the command from node red on a "separate" machine?

Oh you solved it. :grinning:

Yep, I did! :+1: But no, I'm running the command on the only Pi that I have in my car, so a Docker instance running on the host that runs the script. No other Pi's are connected to that network to send the command, and I'm automating a backup to a directory named after date and time every night at 04.30. The window is a safeguard if it stops on something I will be able to connect to it with VNC and see what's holding it up.