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}
}"