For faster navigation, this Iframe is preloading the Wikiwand page for pexec.

pexec

pexec
开发者GNU计划
原始码库 编辑维基数据链接
编程语言C
操作系统Linux和其他类Unix操作系统
类型实用工具
许可协议GPLv3
网站www.gnu.org/software/pexec/ 编辑维基数据

pexec是用于Linux和其他类Unix操作系统的命令行实用工具,它允许用户并行的执行shell命令。指定代码可以要么在本地要么在远程主机上执行,它使用ssh与远程主机建立安全通道。类似于shell循环,在循环开始任务重复时变更一个变量,它可以将多个值传递给指定命令或脚本。pexec是自由软件实用工具,是GNU计划的一部分[1],它可在GPLv3条款下获得[2],是当前Debian稳定发行版的一部分[3]

用法

[编辑]

最常用的用法是替代shell循环,例如将:

 for x in v1 v2 v3 v4 ; do 
     do_something $x
 done

替代为如何下形式:

 pexec -r v1 v2 v3 v4 -e x -o - -c 'do_something $x'

这里的集合有四个元素v1、v2、v3、v4,定义了(环境)变量$x可有的值。程序pexec的特征还有:

  • 自动重定向标准输入标准输出标准错误输出来自或去到正规文件;
  • 从文件而非命令行参数获得输入集合;
  • 重新格式化输出和错误流的能力;
  • 支持在shell循环内部的互斥排他和原子性命令执行(为了避免不希望的高I/O负荷);
  • 使用其他remote shell替代ssh
  • 使用监管(supervisor)守护程序进行在pexec的并行实例间的资源平衡。

可选特征可以使用命令行参数来获取。作为缺省,pexec尝试检测CPU数目并全部使用它们。

参见

[编辑]

引用

[编辑]
  1. ^ pexec - Summary. [25 June 2012]. (原始内容存档于2019-05-30). 
  2. ^ www.gnu.org/software/pexec/. [2019-05-30]. (原始内容存档于2019-06-01). 
  3. ^ packages.debian.org/stable/pexec. [2019-05-30]. (原始内容存档于2019-02-07). 

外部链接

[编辑]
{{bottomLinkPreText}} {{bottomLinkText}}
pexec
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?