Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Lightweight Automated Operation and maintenance tools pssh and pslurp

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

pssh project

Project: http://www.example.com

Grammar:

Usage: pscp.pssh [OPTIONS] local remote

Common options:

--version:View version-h: Host file list, content format "[user@] host [: port]"-H: Host string, content format "[user@] host [: port]"-A: Manual password input mode-i: Internal processing information per server Output-l: User name used for login-p: Number of concurrent threads [optional]-o: Output directory of standard output file (optional)-e: Output directory of standard error file (optional)-t: TIMEOUT timeout setting, 0 unlimited [optional]-O: Options for SSH-P: Print out server return message-v: verbose mode

[Example 1] Batch echo "hello pssh" to hosts in the host file list through pssh.

[root@CentOS7 ~]# cat host.txt 172.20.200.200192.168.8.61[root@CentOS7 ~]# pssh -h host.txt -i echo "hello pssh"[1] 16:31:10 [SUCCESS] 192.168.8.61hello pssh[2] 16:31:10 [SUCCESS] 172.20.200.200hello pssh

Note: When ssh key authentication is not supported, you can manually input password authentication to execute batch instructions through-A option.

[Example 2] Save both standard error and standard correct redirects to the/app directory of the local host.

[root@CentOS7~]#pssh-h host.txt-o/app/-e/app/-i echo "hello pssh"[1] 16:52:32 [SUCCESS] 192.168.8.61hello pssh [2] 16:52:32 [SUCCESS] www.example.com hello pssh [root@CentOS7~]#ls/app/172.20.200 www.example.com [root@CentOS7~]#cat/app/192.168.8.61 hello pssh scp. pssh Command

Function: Batch copy local files to remote host

Grammar:

[root@CentOS7 ~]# pscp.pssh --helpUsage: pscp.pssh [OPTIONS] local remote

Options: Basically the same as pssh, except there is a-r option to recursively copy directories

[Example 1] Batch copy the local/etc/fstab file to the host/app directory in the host list file

[root@CentOS7 ~]# pscp.pssh -h host.txt /etc/fstab /app/[1] 17:19:32 [SUCCESS] 192.168.8.61[2] 17:19:32 [SUCCESS] 172.20.200.200[root@CentOS7 ~]# pssh -h host.txt -i ls /app/ -l[1] 17:25:14 [SUCCESS] 192.168.8.61total 4-rw-r--r-- 1 root root 595 Nov 8 20:27 fstab[2] 17:25:14 [SUCCESS] 172.20.200.200total 4-rw-r--r-- 1 root root 595 Nov 9 17:19 fstab

[Example 2] Copy the local directory/test/to the host 's/app directory in the host file list in batch

[root@CentOS7~]#pscp. pssh-h host.txt-r/test//app/[1] 17:23:14 [SUCCESS] 192.168.8.61 [2] 17:23:[SUCCESS] 172.20.200.200 [root@CentOS7~]#pssh-h host.txt-i ls/app/-l [1] 17:26:33 [SUCCESS] 192.168.8.61total 8-rw-r--r--1 root root 595 Nov 8 20:27 fstabdrwxr-xr-x 2 root root 4096 Nov 8 20:33 test [2] 17:26:33 [SUCCESS] 172.20.200.200total 4-rw-r--r--1 root root 595 Nov 9 17:19 fstabdrwxr-xr-x 2 root 48 Nov 9 17:25 testpslurp command

Function: Copy files from remote host to local in batches, opposite to pscp. pssh command function.

Grammar:

pslurp [-vAr][-h hosts_file][-H [user@] host [: port]][-l user][-p par][-o outdir][-e errdir][-t timeout][-O options][-xargs][-X arg][-L localdir] remote local

Options:

- L copies files from a remote host to a given local directory, where local is the name of the downloaded file

[Example] Batch download the passwd file of the target server to the local directory/app, and rename it user

[root@CentOS7 ~]# pslurp -h host.txt -L /app/ /etc/passwd user[1] 17:35:38 [SUCCESS] 192.168.8.61[2] 17:35:38 [SUCCESS] 172.20.200.200[root@CentOS7 ~]# tree /app//app/├── 172.20.200.200│ └── user└── 192.168.8.61 └── user2 directories, 2 files

Original text from: www.example.com

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report