Skip to content

Commit 6f3b3d1

Browse files
committed
Updated readme with sftp example
1 parent ae78e65 commit 6f3b3d1

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

README.rst

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,31 @@ To install gevent you need the libevent-dev package installed. Instructions belo
1818
$ sudo apt-get install libevent-dev
1919
$ pip install parallel-ssh
2020

21-
************
21+
*************
2222
Usage Example
23-
************
23+
*************
2424

2525
>>> from pssh import ParallelSSHClient
2626
>>> hosts = ['myhost1', 'myhost2']
2727
>>> client = ParallelSSHClient(hosts)
2828
>>> cmds = client.exec_command('ls -ltrh /tmp/aasdfasdf', sudo = True)
2929
>>> print [client.get_stdout(cmd) for cmd in cmds]
30+
[localhost] drwxr-xr-x 6 xxx xxx 4.0K Jan 1 00:00 xxx
31+
[{'localhost': {'exit_code': 0}}]
32+
33+
34+
************
35+
SFTP support
36+
************
37+
38+
SFTP is supported (scp version 2 protocol) natively, no scp command used.
39+
40+
For example to copy a local file to remote hosts in parallel
41+
42+
>>> from pssh import ParallelSSHClient
43+
>>> hosts = ['myhost1', 'myhost2']
44+
>>> client = ParallelSSHClient(hosts)
45+
>>> cmds = client.copy_file('../test', 'test_dir/test')
46+
>>> client.pool.join()
47+
`Copied local file ../test to remote destination localhost:test_dir/test`
48+

0 commit comments

Comments
 (0)