Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 运行此shell脚本时被阻止_Linux_Shell - Fatal编程技术网

Linux 运行此shell脚本时被阻止

Linux 运行此shell脚本时被阻止,linux,shell,Linux,Shell,当我运行这个脚本时,它将被阻塞并终止。 “服务器”是主机名列表; 请帮我看看为什么,我的代码有什么问题。 错误消息如下: #!/bin/bash SERVERS="master slave1 slave2 slave3" for SERVER in $SERVERS do expect -c "set timeout -1; spawn ssh hadoop@$SERVER; expect { *(yes/

当我运行这个脚本时,它将被阻塞并终止。 “服务器”是主机名列表; 请帮我看看为什么,我的代码有什么问题。 错误消息如下:

#!/bin/bash

SERVERS="master slave1 slave2 slave3"

for SERVER in $SERVERS
do
  expect -c "set timeout -1;
             spawn ssh hadoop@$SERVER;
             expect {
               *(yes/no)* {send -- yes\r;exp_continue}
               *assword:* {send -- hadoop\r;exp_continue}
               *$* {send -- \"echo 'ssss'\r\";exp_continue}
               *$* {send -- exit\r;exp_continue}
               eof {exit;0}
              }";
done

显示for循环中的$SERVER可能会提供有关该问题的线索。将错误消息翻译成英语也可能有助于获得更好的响应。这看起来像是进程被SIGKILL终止时shell打印的消息。你的内存用完了吗?
spawn ssh hadoop@master
./gather_pub_key.sh: line 5:  2695 killed              expect -c "set timeout -1;
             spawn ssh hadoop@$SERVER;
             expect {
               *(yes/no)* {send -- yes\r;exp_continue}
               *assword:* {send -- hadoop\r;exp_continue}
               *$* {send -- \"echo 'ssss'\r\";exp_continue}
               *$* {send -- exit\r;exp_continue}
               eof {exit;0}
              }"