kitech / parallel-ssh Goto Github PK
View Code? Open in Web Editor NEWlittle modified from original parallel-ssh for suite my work needs;
Home Page: http://nullget.sourceforge.net/?q=node/494
License: Other
little modified from original parallel-ssh for suite my work needs;
Home Page: http://nullget.sourceforge.net/?q=node/494
License: Other
pssh --help
Usage: pssh [OPTIONS] -h hosts.txt command [...]
Options:
--version show program's version number and exit
--help show this help message and exit
-h HOST_FILE, --hosts=HOST_FILE
hosts file (each line "[user@]host[:port]")
-H HOST_STRING, --host=HOST_STRING
additional host entries ("[user@]host[:port]")
主机格式还是旧的,应该是:
1. host[:port] [login[:passwd]]
2. [user[:passwd]@]host[:port]
it shows
UnboundLocalError: local variable 'ssh' referenced before assignment
i check the source code and the reson is you commented ssh = ['ssh'] in line 72, and when passwd == None,this variable will not be assigned. then it died when i use -O option.
# ssh = ['ssh']
if passwd == None:
ssh = ['ssh']
# sys.stderr.write('using standard ssh method\n')
else:
cmd = ['sshpass', '-p', passwd, 'ssh']
# sys.stderr.write('using sshpass method\n')
if opts.options:
for opt in opts.options:
ssh += ['-o', opt]
if port:
ssh += ['-p', port]
if opts.ssh_args:
ssh += [opts.ssh_args]
cmd = ['rsync', '-e', ' '.join(ssh)]
i modified code like below, problem resolved.
ssh = ['ssh']
if opts.options:
for opt in opts.options:
ssh += ['-o', opt]
if port:
ssh += ['-p', port]
if opts.ssh_args:
ssh += [opts.ssh_args]
if passwd == None:
cmd = ['rsync', '-e', ' '.join(ssh)]
# sys.stderr.write('using standard ssh method\n')
else:
cmd = ['sshpass', '-p', passwd, 'rsync', '-e', ' '.join(ssh)]
# sys.stderr.write('using sshpass method\n')
当本机第一次pssh远程主机时会失败,因为第一次ssh会出现如下选择:
Are you sure you want to continue connecting (yes/no)? yes
shell下可以用expect来处理,而python下有pexpect,希望pssh能内置此功能~
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.