I want to run a simple script from remote machine. The script contains the following:
我想从远程机器运行一个简单的脚本。该脚本包含以下内容:
#!/usr/bin/python
import os
print str(os.popen('stty size', 'r').read())
If I run it from local machine I get fine output, something like 36 138
. If I try to run it from another machine, I get <ip>: stty: standard input: Invalid argument
(using ssh ot pdsh).
如果我从本地机器运行它,我得到很好的输出,如36 138.如果我尝试从另一台机器运行它,我得到
The problem is I can't change the script that is using the stty command. This is a common script, which I write wrapper to. Suggestions ?
问题是我无法更改使用stty命令的脚本。这是一个常见的脚本,我编写了包装器。建议?
1 个解决方案
#1
3
As BroSlow said, ssh -t
will solve the problem if using ssh
.
正如BroSlow所说,如果使用ssh,ssh -t将解决问题。
If using pdsh
via ssh
, I used the following:
如果通过ssh使用pdsh,我使用以下内容:
export PDSH_SSH_ARGS_APPEND="-tt -q"
pdsh -w ${machine_list} -S -R ssh ${cmd}
PDSH_SSH_ARGS_APPEND
is used to append arguments to the ssh command generated by the pdsh
, as the name hints.
PDSH_SSH_ARGS_APPEND用于将参数附加到由pdsh生成的ssh命令,如名称提示。
#1
3
As BroSlow said, ssh -t
will solve the problem if using ssh
.
正如BroSlow所说,如果使用ssh,ssh -t将解决问题。
If using pdsh
via ssh
, I used the following:
如果通过ssh使用pdsh,我使用以下内容:
export PDSH_SSH_ARGS_APPEND="-tt -q"
pdsh -w ${machine_list} -S -R ssh ${cmd}
PDSH_SSH_ARGS_APPEND
is used to append arguments to the ssh command generated by the pdsh
, as the name hints.
PDSH_SSH_ARGS_APPEND用于将参数附加到由pdsh生成的ssh命令,如名称提示。