Bash スクリプトでリモートでコマンドを実行し、リモート ターミナルを終了する方法

Bash スクリプトでリモートでコマンドを実行し、リモート ターミナルを終了する方法

次のコマンドを実行しようとしています:

ssh nvidia@ubuntu-ip-address "/opt/ads2/arm-linux64/bin/ads2 svcd &"

"/opt/ads2/arm-linux64/bin/ads2 svcd&"これは、Ctrl + C を入力しない限り、実行時にリモート ターミナルでハングすることを除いて、これまでのところは機能します(下の画像を参照)。

ここに画像の説明を入力してください

"/opt/ads2/arm-linux64/bin/ads2 svcd &"そこで、コマンドを実行した後、リモート ターミナルを終了して、ローカル bash スクリプトの実行を継続するコマンドを探しています。

以下は私が取り組んでいるbashスクリプトです

#!/usr/bin/env bash

echo "Welcome to ADS2 Session Start..."

while  true 
do
echo "Starting service Daemon on the targert"
echo "Enter the ip-address of the target"
read x
if [ -z "$x" ]
then 
    echo "ip-address is empty"
else
    echo "Connecting with target..."
    if [[ $x =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ || $x =~ ^fdt-c-agx-[0-9][0- 
      9][0-9][0-9]$ ]]
    then
        ssh nvidia@"$x"   "/opt/ads2/arm-linux64/bin/ads2 svcd &"; exit 0 
        if ! ssh nvidia@"$x"
        then
            echo -e "\033[31mconnection failed\e[0m" 
        else
            echo -e "\033[32m connection succeded\e[0m"
        
            break
        fi
    else
        "Make sure the io address in the coorect form"  
    fi

fi
done

関連情報