欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

轻型行动工具 pssh

最编程 2024-07-18 15:57:51
...
从远程拉取文件到本地,在本地自动创建目录名为远程主机ip的目录,将拉取的文件放在对应主机IP目录下
Usage: pslurp [OPTIONS] -h hosts.txt -o outdir remote local

-r --recursive recusively copy directories (OPTIONAL)
-L --localdir output directory for remote file copies
-h --hosts hosts file (each line "host[:port] [login]")
-l --user username (OPTIONAL)
-p --par max number of parallel threads (OPTIONAL)
-o --outdir output directory for stdout files (OPTIONAL)
-e --errdir output directory for stderr files (OPTIONAL)
-t --timeout timeout (secs) (-1 = no timeout) per host (OPTIONAL)
-v --verbose turn on warning and diagnostic messages (OPTIONAL)
-O --options SSH options (OPTIONAL)

Example: pslurp -h hosts.txt -L /tmp/outdir -l irb2 /home/irb2/foo.txt foo.txt
-L /tmp/outdir:指定从远程主机拷贝文件放置的目录,拷贝远程主机/home/irb2/foo.txt文件,并将其重命名为foo.txt.
如果拷贝目录需要使用-r参数:
#格式:pslurp -h ip.txt -L <本地目录> <远程目录/文件> <本地重命名>
#拉取文件
pslurp -h ip.txt -L /root/ /root/1.jpg picture
ll /root/172.16.1.13/picture
-rw-r--r-- 1 root root 148931 Jan 9 15:41 /root/172.16.1.13/picture
#拉取目录
pslurp -r -h ip.txt -L /root/ /root/test temp
ll -d /root/172.16.1.13/temp/
drwxr-xr-x 2 root root 23 Jan 9 15:49 /root/172.16.1.13/temp/