免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2732 | 回复: 8
打印 上一主题 下一主题

[系统管理] 请问如下命令是干嘛用的,谁帮忙解释下,很感谢! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-11-07 10:38 |只看该作者 |倒序浏览
#!/usr/bin/env bash


pdsh -w ^/opt/shell/master/cluster_command/adam_agent.txt $@

帮忙解释详细点,每个参数都代表什么意思,非常感谢!在线等,呵呵

论坛徽章:
15
2015年辞旧岁徽章
日期:2015-03-03 16:54:15双鱼座
日期:2015-01-15 17:29:44午马
日期:2015-01-06 17:06:51子鼠
日期:2014-11-24 10:11:13寅虎
日期:2014-08-18 07:10:55酉鸡
日期:2014-04-02 12:24:51双子座
日期:2014-04-02 12:19:44天秤座
日期:2014-03-17 11:43:36亥猪
日期:2014-03-13 08:13:51未羊
日期:2014-03-11 12:42:03白羊座
日期:2013-11-20 10:15:18CU大牛徽章
日期:2013-04-17 11:48:45
2 [报告]
发表于 2012-11-21 11:22 |只看该作者
自己要先看一下帮助

man pdsh

-w TARGETS,...

Target and or filter the specified list of hosts. Do not use with any other node selection options (e.g. -a, -g, if they are available). No spaces are allowed in the comma-separated list. Arguments in the TARGETS list may include normal host names, a range of hosts in hostlist format (See HOSTLIST EXPRESSIONS), or a single '-' character to read the list of hosts on stdin.
If a host or hostlist is preceded by a '-' character, this causes those hosts to be explicitly excluded. If the argument is preceded by a single '^' character, it is taken to be the path to file containing a list of hosts, one per line. If the item begins with a '/' character, it is taken as a regular expression on which to filter the list of hosts (a regex argument may also be optionally trailed by another '/', e.g. /node.*/). A regex or file name argument may also be preceeded by a minus '-' to exclude instead of include thoses hosts.

A list of hosts may also be preceded by "user@" to specify a remote username other than the default, or "rcmd_type:" to specify an alternate rcmd connection type for these hosts. When used together, the rcmd type must be specified first, e.g. "ssh:user1@host0" would use ssh to connect to host0 as user "user1."
  1. $@
  2. 与$*同义,但是每个参数都是一个独立的""引用字串,这就意味着参数被完整地传递,并没有被解释和扩展.这也意味着,每个参数列表中的每个参数都被当成一个独立的单词.
  3. 注意:"$@"必须被""引用.
复制代码

论坛徽章:
15
2015年辞旧岁徽章
日期:2015-03-03 16:54:15双鱼座
日期:2015-01-15 17:29:44午马
日期:2015-01-06 17:06:51子鼠
日期:2014-11-24 10:11:13寅虎
日期:2014-08-18 07:10:55酉鸡
日期:2014-04-02 12:24:51双子座
日期:2014-04-02 12:19:44天秤座
日期:2014-03-17 11:43:36亥猪
日期:2014-03-13 08:13:51未羊
日期:2014-03-11 12:42:03白羊座
日期:2013-11-20 10:15:18CU大牛徽章
日期:2013-04-17 11:48:45
3 [报告]
发表于 2012-11-21 11:22 |只看该作者
dsy851009 发表于 2012-11-07 12:38
#!/usr/bin/env bash

自己要先看一下帮助
  1. man pdsh

  2. -w TARGETS,...

  3. Target and or filter the specified list of hosts. Do not use with any other node selection options (e.g. -a, -g, if they are available). No spaces are allowed in the comma-separated list. Arguments in the TARGETS list may include normal host names, a range of hosts in hostlist format (See HOSTLIST EXPRESSIONS), or a single '-' character to read the list of hosts on stdin.
  4. If a host or hostlist is preceded by a '-' character, this causes those hosts to be explicitly excluded. If the argument is preceded by a single '^' character, it is taken to be the path to file containing a list of hosts, one per line. If the item begins with a '/' character, it is taken as a regular expression on which to filter the list of hosts (a regex argument may also be optionally trailed by another '/', e.g. /node.*/). A regex or file name argument may also be preceeded by a minus '-' to exclude instead of include thoses hosts.
复制代码
A list of hosts may also be preceded by "user@" to specify a remote username other than the default, or "rcmd_type:" to specify an alternate rcmd connection type for these hosts. When used together, the rcmd type must be specified first, e.g. "ssh:user1@host0" would use ssh to connect to host0 as user "user1."
  1. $@
  2. 与$*同义,但是每个参数都是一个独立的""引用字串,这就意味着参数被完整地传递,并没有被解释和扩展.这也意味着,每个参数列表中的每个参数都被当成一个独立的单词.
  3. 注意:"$@"必须被""引用.
复制代码

论坛徽章:
0
4 [报告]
发表于 2012-11-21 17:17 |只看该作者
回复 3# rdcwayx
谢谢斑竹~~~~~~~~~

   

论坛徽章:
0
5 [报告]
发表于 2012-11-21 18:51 |只看该作者
本帖最后由 力哥丶 于 2012-11-21 18:53 编辑

$@                 所有这些参数都分别被双引号引住。若一个脚本接收到两个参数,$@等价于$1$2

^ 以谁为开头。

^[^1] 除了1开头的

论坛徽章:
0
6 [报告]
发表于 2012-11-30 11:39 |只看该作者
希望这样的回答~~~回复 5# 力哥丶


   

论坛徽章:
0
7 [报告]
发表于 2014-05-10 21:52 |只看该作者
脚本名称叫test.sh 入参三个: 1 2 3运行test.sh 1 2 3后$*为"1 2 3"(一起被引号包住)$@为"1" "2" "3"(分别被包住)$#为3(参数数量)

论坛徽章:
0
8 [报告]
发表于 2014-05-10 21:54 |只看该作者
pdsh 是对集群进行批量操作的命令

论坛徽章:
0
9 [报告]
发表于 2014-05-10 21:56 |只看该作者
如果目标前为“^”,则用来指示包含目标主机的文件,文件中每行一个该机名
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP