Pexec

pexec is a command-line utility for Linux and other Unix-like operating systems which allows the user to execute shell commands in parallel. The specified code can be executed either locally or on remote hosts, in which case ssh is used to build a secure tunnel between them. Similar to shell loops, a variable is changed as the loop starting the tasks iterates, so that many values can get passed to the specified command or script. pexec is a free software utility, and part of the GNU Project.[1] It is available[2] under the terms of GPLv3, and is part of the current Debian stable release.[3]

Usage

The most common usage is to replace the shell loop, for example:

 for x in alpha bravo charlie delta ; do 
     do_something $x
 done

to the form of:

 pexec -r alpha bravo charlie delta -e x -o - -c \
     'do_something $x'

where the set with the 4 elements of "alpha" "bravo" "charlie" and "delta" define the possible values for the (environmental) variable $x. The program pexec features also

  • automatic redirection of standard input, output and error from/to regular files;
  • taking the input set from a file instead of command line argument;
  • the capability for re-formatting the output and error streams;
  • support for mutual exclusions and atomic command executions inside the shell loop (in order to, e.g. avoid unexpectedly high I/O load);
  • using alternative remote shells instead of ssh.
  • using supervisor daemons to balance between the resources of concurrent pexec instances.

Such optional features can be requested using command-line arguments. By default, pexec tries to detect the number of CPUs and uses all of them.

See also

References

  1. ^ "pexec - Summary". Retrieved 25 June 2012.
  2. ^ www.gnu.org/software/pexec/
  3. ^ packages.debian.org/stable/pexec

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.