Pexec
Encyclopedia
pexec is a command-line driven utility for Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

 or other Unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....

 operating systems which allows the user to execute "for ~ do ~ done" like shell
Bourne shell
The Bourne shell, or sh, was the default Unix shell of Unix Version 7 and most Unix-like systems continue to have /bin/sh - which will be the Bourne shell, or a symbolic link or hard link to a compatible shell - even when more modern shells are used by most users.Developed by Stephen Bourne at AT&T...

 loops in parallel
Parallel computing
Parallel computing is a form of computation in which many calculations are carried out simultaneously, operating on the principle that large problems can often be divided into smaller ones, which are then solved concurrently . There are several different forms of parallel computing: bit-level,...

. The specified command
Command (computing)
In computing, a command is a directive to a computer program acting as an interpreter of some kind, in order to perform a specific task. Most commonly a command is a directive to some kind of command line interface, such as a shell....

 or (a piece of) script
Shell script
A shell script is a script written for the shell, or command line interpreter, of an operating system. It is often considered a simple domain-specific programming language...

 can be executed on both local and remote host computers, in the case of remote execution, ssh
Secure Shell
Secure Shell is a network protocol for secure data communication, remote shell services or command execution and other secure network services between two networked computers that it connects via a secure channel over an insecure network: a server and a client...

 is used to build a secure tunnel between the hosts. Like in shell loops, a pre-defined shell (environmental) variable is varied during the loop which is passed transparently to the command or script. pexec is a free software
Free software
Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...

, and part of the GNU
GNU
GNU is a Unix-like computer operating system developed by the GNU project, ultimately aiming to be a "complete Unix-compatible software system"...

 project. It is available under the terms of GPLv3
as well as it is part of the current Debian
Debian
Debian is a computer operating system composed of software packages released as free and open source software primarily under the GNU General Public License along with other free software licenses. Debian GNU/Linux, which includes the GNU OS tools and Linux kernel, is a popular and influential...

 testing release.

Usage

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

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

to the form of

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

where the set with the 5 elements of "alpha" "bravo" "charlie" "delta" and "echo" defines 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
    Load (computing)
    In UNIX computing, the system load is a measure of the amount of work that a computer system performs. The load average represents the average system load over a period of time...

    );
  • using alternative remote shells
    Remote Shell
    The remote shell is a command line computer program that can execute shell commands as another user, and on another computer across a computer network.The remote system to which rsh connects runs the rshd daemon...

     instead of ssh
    Secure Shell
    Secure Shell is a network protocol for secure data communication, remote shell services or command execution and other secure network services between two networked computers that it connects via a secure channel over an insecure network: a server and a client...

    .
  • 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.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK