How to run shell commands?

based @koying solution .
Im running HA on docker (QNAP) .

I copy the remote_command_line custom_components/
I added below:

remote_command_line:
  fetch_ha_image:
    ssh_user: user
    command_timeout: 900
    command: >
        IMAGE=`docker inspect home-assistant | jq -r '.[0].Config.Image'`; docker pull -q ${IMAGE}

When execute I got

2022-11-03 09:44:47.129 ERROR (SyncWorker_6) [custom_components.remote_command_line] Command failed: ssh -4 -o ConnectTimeout=3 -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [email protected] 'IMAGE=`docker inspect home-assistant | jq -r ''.[0].Config.Image''`; docker pull -q ${IMAGE}'

I created ssh key between ha–> qnap
and place it in /share/mynap/HA/ssh/id_rsa
I did verify i’m able to execute script from the HA using:

my_test: ssh -i  /share/mynap/HA/ssh/id_rsa -o UserKnownHostsFile=/dev/null -o 'StrictHostKeyChecking=no' myuser@NAS '. /share/myqnap/HA/MyScripts/test.sh' 

So I edit the custom_components/remote_command_line /init
and place the parameter with hardcoded value in

ssh_command = f"ssh -4 -o ConnectTimeout=3 -o StrictHostKeyChecking=no /share/mynap/HA/ssh/id_rsa myuser@NAS '{escaped_command}'"

and it still through errors:

2022-11-03 10:14:01.563 ERROR (SyncWorker_3) [custom_components.remote_command_line] Command failed: ssh -4 -o ConnectTimeout=3 -o StrictHostKeyChecking=no /share/Avi/HA/ssh/id_rsa myuser@NAS 'IMAGE=`docker inspect home-assistant | jq -r ''.[0].Config.Image''`; docker pull -q ${IMAGE}'

Are you positive the host as seen by the container has that address?
If not, you might have to add ssh_host to the config.

Bottom-line: If it works with myuser@NAS, you probably should use that rather than [email protected]

I run this comand and it works perfectly under windows :

curl -g --anyauth –u “xxxx:xxxxx” “http://192.168.0.165/cgi-bin/configManager.cgi?action=setConfig&Encode[0].ExtraFormat[1].Video.Compression=H.264

But when I try it as a shell command it does nothing…

shell_command:
cocina_c: ‘curl -g --anyauth –u “xxxxx:xxxxxx” “http://192.168.0.165/cgi-bin/configManager.cgi?action=setConfig&Encode[0].ExtraFormat[1].Video.Compression=H.264”’

Can anyone help me?