parallel/parallel.1

572 lines
21 KiB
Groff

.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "PARALLEL 1"
.TH PARALLEL 1 "2010-01-29" "perl v5.10.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
parallel \- build and execute shell command lines from standard input in parallel
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
\&\fBparallel\fR [\-0cfgkqsuvxX] [\-I str] [\-j num] [command [arguments]] < list_of_arguments
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
For each line of input \fBparallel\fR will execute \fBcommand\fR with the
line as arguments. If no \fBcommand\fR is given the line of input is
executed. \fBparallel\fR can often be used as a substitute for \fBxargs\fR
or \fBcat | sh\fR.
.PP
Several lines will be run in parallel.
.IP "\fIcommand\fR" 9
.IX Item "command"
Command to execute. If \fBcommand\fR or the following arguments contain {}
every instance will be substituted with the input line. Setting a
command also invokes \fB\-f\fR.
.Sp
If \fBcommand\fR is given, \fBparallel\fR will behave similar to \fBxargs\fR. If
\&\fBcommand\fR is not given \fBparallel\fR will behave similar to \fBcat | sh\fR.
.IP "\fB\-0\fR" 9
.IX Item "-0"
Use \s-1NUL\s0 as delimiter. Normally input lines will end in \en
(newline). If they end in \e0 (\s-1NUL\s0), then use this option. It is useful
for processing filenames that may contain \en (newline).
.IP "\fB\-c\fR" 9
.IX Item "-c"
Line is a command. The input line contains more than one argument or
the input line needs to be evaluated by the shell. This is the default
if \fBcommand\fR is not set. Can be reversed with \fB\-f\fR.
.IP "\fB\-f\fR" 9
.IX Item "-f"
Line is a filename. The input line contains a filename that will be
quoted so it is not evaluated by the shell. This is the default if
\&\fBcommand\fR is set. Can be reversed with \fB\-c\fR.
.IP "\fB\-g\fR" 9
.IX Item "-g"
Group output. Output from each jobs is grouped together and is only
printed when the command is finished. \s-1STDERR\s0 first followed by \s-1STDOUT\s0.
\&\fB\-g\fR is the default. Can be reversed with \fB\-u\fR.
.IP "\fB\-I\fR \fIstring\fR" 9
.IX Item "-I string"
Use the replacement string \fIstring\fR instead of {}.
.IP "\fB\-j\fR \fIN\fR" 9
.IX Item "-j N"
Run N jobs in parallel. 0 means as many as possible. Default is 10.
.IP "\fB\-j\fR \fI+N\fR" 9
.IX Item "-j +N"
Add N to the number of CPUs. Run this many jobs in parallel. For
compute intensive jobs \fI\-j +0\fR is useful as it will run
number-of-cpus jobs in parallel.
.IP "\fB\-j\fR \fI\-N\fR" 9
.IX Item "-j -N"
Subtract N from the number of CPUs. Run this many jobs in parallel.
If the evaluated number is less than 1 then 1 will be used.
.IP "\fB\-j\fR \fIN\fR%" 9
.IX Item "-j N%"
Multiply N% with the number of CPUs. Run this many jobs in parallel.
If the evaluated number is less than 1 then 1 will be used.
.IP "\fB\-k\fR" 9
.IX Item "-k"
Keep sequence of output same as the order of input. If jobs 1 2 3 4
end in the sequence 3 1 4 2 the output will still be 1 2 3 4.
.IP "\fB\-q\fR" 9
.IX Item "-q"
Quote \fBcommand\fR. This will quote the command line so special
characters are not interpreted by the shell. See the section
\&\s-1QUOTING\s0. Most people will never need this. Quoting is disabled by
default.
.IP "\fB\-s\fR" 9
.IX Item "-s"
Silent. The job to be run will not be printed. This is the default.
Can be reversed with \fB\-v\fR.
.IP "\fB\-u\fR" 9
.IX Item "-u"
Ungroup output. Output is printed as soon as possible. This may cause
output from different commands to be mixed. Can be reversed with \fB\-g\fR.
.IP "\fB\-v\fR" 9
.IX Item "-v"
Verbose. Print the job to be run. Can be reversed with \fB\-s\fR.
.IP "\fB\-x\fR" 9
.IX Item "-x"
xargs. Insert as many arguments as the command line length permits. If
{} is not used the arguments will be appended to the line. If {} is
used multiple times each {} will be replaced with all the arguments.
.IP "\fB\-X\fR" 9
.IX Item "-X"
xargs with context replace. This works like \fB\-x\fR except if {} is part
of a word (like \fIpic{}.jpg\fR) then the whole word will be repeated.
.SH "EXAMPLE 1: Working as cat | sh. Ressource inexpensive jobs and evaluation"
.IX Header "EXAMPLE 1: Working as cat | sh. Ressource inexpensive jobs and evaluation"
\&\fBparallel\fR can work similar to \fBcat | sh\fR.
.PP
A ressource inexpensive job is a job that takes very little \s-1CPU\s0, disk
I/O and network I/O. Ping is an example of a ressource inexpensive
job. wget is too \- if the webpages are small.
.PP
The content of the file jobs_to_run:
.PP
.Vb 7
\& ping \-c 1 10.0.0.1
\& wget http://status\-server/status.cgi?ip=10.0.0.1
\& ping \-c 1 10.0.0.2
\& wget http://status\-server/status.cgi?ip=10.0.0.2
\& ...
\& ping \-c 1 10.0.0.255
\& wget http://status\-server/status.cgi?ip=10.0.0.255
.Ve
.PP
To run 100 processes simultaneously do:
.PP
\&\fBparallel \-j 100 < jobs_to_run\fR
.PP
As there is not a \fBcommand\fR the option \fB\-c\fR is default because the
jobs needs to be evaluated by the shell.
.SH "EXAMPLE 2: Working as xargs \-n1. Argument appending"
.IX Header "EXAMPLE 2: Working as xargs -n1. Argument appending"
\&\fBparallel\fR can work similar to \fBxargs \-n1\fR.
.PP
To output all html files run:
.PP
\&\fBfind . \-name '*.html' | parallel cat\fR
.PP
As there is a \fBcommand\fR the option \fB\-f\fR is default because the
filenames needs to be protected from the shell in case a filename
contains special characters.
.SH "EXAMPLE 3: Compute intensive jobs and substitution"
.IX Header "EXAMPLE 3: Compute intensive jobs and substitution"
If ImageMagick is installed this will generate a thumbnail of a jpg
file:
.PP
\&\fBconvert \-geometry 120 foo.jpg thumb_foo.jpg\fR
.PP
If the system has more than 1 \s-1CPU\s0 it can be run with number-of-cpus
jobs in parallel (\-j +0). This will do that for all jpg files in a
directory:
.PP
\&\fBls *.jpg | parallel \-j +0 convert \-geometry 120 {} thumb_{}\fR
.PP
To do it recursively use \fBfind\fR:
.PP
\&\fBfind . \-name '*.jpg' | parallel \-j +0 convert \-geometry 120 {} {}_thumb.jpg\fR
.PP
Notice how the argument has to start with {} as {} will include path
(e.g. running \fBconvert \-geometry 120 ./foo/bar.jpg
thumb_./foo/bar.jpg\fR would clearly be wrong). It will result in files
like ./foo/bar.jpg_thumb.jpg. If that is not wanted this can fix it:
.PP
.Vb 3
\& find . \-name \*(Aq*.jpg\*(Aq | \e
\& perl \-pe \*(Aqchomp; $a=$_; s:/([^/]+)$:/thumb_$1:; $_="convert \-geometry 120 $a $_\en"\*(Aq | \e
\& parallel \-c \-j +0
.Ve
.PP
Unfortunately this will not work if the filenames contain special
characters (such as space or quotes). If you have \fBren\fR installed this
is a better solution:
.PP
.Vb 2
\& find . \-name \*(Aq*.jpg\*(Aq | parallel \-j +0 convert \-geometry 120 {} {}_thumb.jpg
\& find . \-name \*(Aq*_thumb.jpg\*(Aq | ren \*(Aqs:/([^/]+)_thumb.jpg$:/thumb_$1:\*(Aq
.Ve
.SH "EXAMPLE 4: Substitution and redirection"
.IX Header "EXAMPLE 4: Substitution and redirection"
This will compare all files in the dir to the file foo and save the
diffs in corresponding .diff files:
.PP
\&\fBls | parallel diff {} foo "\fR>\fB"{}.diff\fR
.PP
Quoting of > is necessary to postpone the redirection. Another
solution is to quote the whole command:
.PP
\&\fBls | parallel "diff {} foo \fR>\fB{}.diff"\fR
.SH "EXAMPLE 5: Composed commands"
.IX Header "EXAMPLE 5: Composed commands"
A job can consist of several commands. This will print the number of
files in each directory:
.PP
\&\fBls | parallel 'echo \-n {}\*(L" \*(R"; ls {}|wc \-l'\fR
.PP
To put the output in a file called <name>.dir:
.PP
\&\fBls | parallel '(echo \-n {}\*(L" \*(R"; ls {}|wc \-l) \fR> \fB{}.dir'\fR
.SH "EXAMPLE 6: Context replace"
.IX Header "EXAMPLE 6: Context replace"
To remove the files \fIpict0000.jpg\fR .. \fIpict9999.jpg\fR you could do:
.PP
\&\fBseq \-f \f(CB%04g\fB 0 9999 | parallel rm pict{}.jpg\fR
.PP
You could also do:
.PP
\&\fBseq \-f \f(CB%04g\fB 0 9999 | perl \-pe 's/(.*)/pict$1.jpg/' | parallel \-x rm\fR
.PP
The first will run \fBrm\fR 10000 times, while the last will only run
\&\fBrm\fR as many times needed to keep the command line length short
enough (typically 1\-2 times).
.PP
You could also run:
.PP
\&\fBseq \-f \f(CB%04g\fB 0 9999 | parallel \-X rm pict{}.jpg\fR
.PP
This will also only run \fBrm\fR as many times needed to keep the command
line length short enough.
.SH "EXAMPLE 7: Group output lines"
.IX Header "EXAMPLE 7: Group output lines"
When runnning jobs that output data, you often do not want the output
of multiple jobs to run together. \fBparallel\fR defaults to grouping the
output of each job, so the output is printed when the job finishes. If
you want the output to be printed while the job is running you can use
\&\fB\-u\fR.
.PP
Compare the output of:
.PP
\&\fB(echo foss.org.my; echo www.debian.org; echo www.freenetproject.org) | parallel traceroute\fR
.PP
to the output of:
.PP
\&\fB(echo foss.org.my; echo www.debian.org; echo www.freenetproject.org) | parallel \-u traceroute\fR
.SH "EXAMPLE 8: Keep order of output same as order of input"
.IX Header "EXAMPLE 8: Keep order of output same as order of input"
Normally the output of a job will be printed as soon as it
completes. Sometimes you want the order of the output to remain the
same as the order of the input. \fB\-k\fR will make sure the order of
output will be in the same order as input even if later jobs end
before earlier jobs.
.PP
\&\fB(echo foss.org.my; echo www.debian.org; echo www.freenetproject.org) | parallel traceroute\fR
.PP
will give traceroute of foss.org.my, www.debian.org and
www.freenetproject.org, but it will be sorted according to which job
completed first.
.PP
To keep the order the same as input run:
.PP
\&\fB(echo foss.org.my; echo www.debian.org; echo www.freenetproject.org) | parallel \-k traceroute\fR
.PP
This will make sure the traceroute to foss.org.my will be printed
first.
.SH "QUOTING"
.IX Header "QUOTING"
For more advanced use quoting may be an issue. The following will
print the filename for each line that has exactly 2 columns:
.PP
\&\fBperl \-ne '/^\eS+\es+\eS+$/ and print \f(CB$ARGV\fB,\*(L"\en\*(R"' file\fR
.PP
This can be done by \fBparallel\fR using:
.PP
\&\fBls | parallel \*(L"perl \-ne '/^\e\eS+\e\es+\e\eS+$/ and print \e$ARGV,\e\*(R"\e\en\e\*(L"'\*(R"\fR
.PP
Notice how \e's, "'s, and $'s needs to be quoted. \fBparallel\fR can do
the quoting by using option \fB\-q\fR:
.PP
\&\fBls | parallel \-q perl \-ne '/^\eS+\es+\eS+$/ and print \f(CB$ARGV\fB,\*(L"\en\*(R"'\fR
.PP
However, this means you cannot make the shell interpret special
characters. For example this \fBwill not work\fR:
.PP
\&\fBls | parallel \-q "diff {} foo \fR>\fB{}.diff"\fR
.PP
\&\fBls | parallel \-q \*(L"ls {} | wc \-l\*(R"\fR
.PP
because > and | need to be interpreted by the shell.
.PP
If you get errors like:
.PP
\&\fBsh: \-c: line 0: syntax error near unexpected token\fR
.PP
then you might try using \fB\-q\fR.
.PP
If you are using \fBbash\fR process substitution like \fB<(cat foo)\fR then
you may try \fB\-q\fR and prepending \fBcommand\fR with \fBbash \-c\fR:
.PP
\&\fBls | parallel \-q bash \-c 'wc \-c <(echo {})'\fR
.PP
Or for substituting output:
.PP
\&\fBls | parallel \-q bash \-c 'tar c {} | tee \fR>\fB(gzip \fR>\fB{}.tar.gz) | bzip2 \fR>\fB{}.tar.bz2'\fR
.PP
\&\fBConclusion\fR: To avoid dealing with the quoting problems it may be
easier just to write a small script and have \fBparallel\fR call that
script.
.SH "LIST RUNNING JOBS"
.IX Header "LIST RUNNING JOBS"
To list the jobs currently running you can run:
.PP
\&\fBkillall \-USR1 parallel\fR
.PP
\&\fBparallel\fR will then print the currently running jobs on \s-1STDERR\s0.
.SH "COMPLETE RUNNING JOBS BUT DO NOT START NEW JOBS"
.IX Header "COMPLETE RUNNING JOBS BUT DO NOT START NEW JOBS"
If you regret starting a lot of jobs you can simply break \fBparallel\fR,
but if you want to make sure you do not have halfcompleted jobs you
should send the signal \fB\-USR2\fR to \fBparallel\fR:
.PP
\&\fBkillall \-USR2 parallel\fR
.PP
This will tell \fBparallel\fR to not start any new jobs, but wait until
the currently running jobs are finished.
.SH "DIFFERENCES BETWEEN xargs/find \-exec AND parallel"
.IX Header "DIFFERENCES BETWEEN xargs/find -exec AND parallel"
\&\fBxargs\fR and \fBfind \-exec\fR offer some of the same possibilites as
\&\fBparallel\fR.
.PP
\&\fBfind \-exec\fR only works on files. So processing other input (such as
hosts or URLs) will require creating these inputs as files. \fBfind
\&\-exec\fR has no support for running commands in parallel.
.PP
\&\fBxargs\fR deals badly with special characters (such as space, ' and
"). To see the problem try this:
.PP
touch important_file
touch 'not important_file'
ls not* | xargs rm
.PP
You can specify \fB\-0\fR or \fB\-d \*(L"\en\*(R"\fR, but many input generators are not
optimized for using \fB\s-1NUL\s0\fR as separator but are optimized for
\&\fBnewline\fR as separator. E.g \fBhead\fR, \fBtail\fR, \fBawk\fR, \fBls\fR, \fBecho\fR,
\&\fBsed\fR, \fBtar \-v\fR, \fBperl\fR (\-0 and \e0 instead of \en), \fBlocate\fR
(requires using \-0), \fBfind\fR (requires using \-print0), \fBgrep\fR
(requires user to use \-z or \-Z).
.PP
So \fBparallel\fR's newline separation can be emulated with:
.PP
\&\fBcat | xargs \-d \*(L"\en\*(R" \-n1 \f(BIcommand\fB\fR
.PP
\&\fBxargs\fR can run a given number of jobs in parallel, but has no
support for running no_of_cpus jobs in parallel.
.PP
\&\fBxargs\fR has no support for grouping the output, therefore output may
run together, e.g. the first half of a line is from one process and
the last half of the line is from another process.
.PP
\&\fBxargs\fR has no support for keeping the order of the output, therefore
if running jobs in parallel using \fBxargs\fR the output of the second
job cannot be postponed till the first job is done.
.PP
\&\fBxargs\fR has no support for context replace, so you will have to create the
arguments.
.PP
If you use a replace string in \fBxargs\fR (\fB\-I\fR) you can not force
\&\fBxargs\fR to use more than one argument.
.PP
Quoting in \fBxargs\fR works like \fB\-q\fR in \fBparallel\fR. This means
composed commands and redirection requires using \fBbash \-c\fR.
.PP
\&\fBls | parallel "wc {} \fR> \fB{}.wc"\fR
.PP
becomes
.PP
\&\fBls | xargs \-d \*(L"\en\*(R" \-P10 \-I {} bash \-c "wc {} \fR>\fB {}.wc"\fR
.PP
and
.PP
\&\fBls | parallel \*(L"echo {}; ls {}|wc\*(R"\fR
.PP
becomes
.PP
\&\fBls | xargs \-d \*(L"\en\*(R" \-P10 \-I {} bash \-c \*(L"echo {}; ls {}|wc\*(R"\fR
.SH "DIFFERENCES BETWEEN mdm/middleman AND parallel"
.IX Header "DIFFERENCES BETWEEN mdm/middleman AND parallel"
middleman(mdm) is also a tool for running jobs in parallel.
.PP
Here are the shellscripts of http://mdm.berlios.de/usage.html ported
to parallel use:
.PP
\&\fBseq 1 19 | parallel \-j+0 buffon \-o \- | sort \-n \fR>\fB result\fR
.PP
\&\fBcat files | parallel \-j+0 cmd\fR
.SH "BUGS"
.IX Header "BUGS"
Filenames beginning with '\-' can cause some commands to give
unexpected results, as it will often be interpreted as an option.
.SH "REPORTING BUGS"
.IX Header "REPORTING BUGS"
Report bugs to <bug\-parallel@tange.dk>.
.SH "IDEAS"
.IX Header "IDEAS"
xargs dropin-replacement.
Implement the missing \-\-features
.PP
monitor to see which jobs are currently running
http://code.google.com/p/ppss/
.PP
Accept signal \s-1INT\s0 to complete current running jobs but do not start
new jobs. Print out the number of jobs waiting to complete on
\&\s-1STDERR\s0. Accept sig \s-1INT\s0 again to kill now. This seems to be hard, as
all foreground processes get the \s-1INT\s0 from the shell.
.PP
Distibute jobs to computers with different speeds/no_of_cpu using ssh
ask the computers how many cpus they have and spawn appropriately
according to \-j setting.
http://www.semicomplete.com/blog/geekery/distributed\-xargs.html?source=rss20
.SS "\-S"
.IX Subsection "-S"
\&\-S sshlogin[,sshlogin]
.PP
sshlogin is [user@]host or filename with list of sshlogin
.PP
What about copying data to/from remote host?
.PP
Parallelize so this can be done:
mdm.screen find dir \-execdir mdm-run cmd {} \e;
Maybe:
find dir \-execdir parallel \-\-communication\-file /tmp/comfile cmd {} \e;
.SS "Comfile"
.IX Subsection "Comfile"
This will put a lock on /tmp/comfile. The number of locks is the number of running commands.
If the number is smaller than \-j then it will start a process in the background ( cmd & ),
otherwise wait.
.PP
parallel \-\-wait /tmp/comfile will wait until no more locks on the file
.SH "AUTHOR"
.IX Header "AUTHOR"
Copyright (C) 2007\-10\-18 Ole Tange, http://ole.tange.dk
.PP
Copyright (C) 2008\-2009 Ole Tange, http://ole.tange.dk
.SH "LICENSE"
.IX Header "LICENSE"
Copyright (C) 2007\-2009 Free Software Foundation, Inc.
.PP
This program is free software; you can redistribute it and/or modify
it under the terms of the \s-1GNU\s0 General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
.PP
This program is distributed in the hope that it will be useful,
but \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of
\&\s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. See the
\&\s-1GNU\s0 General Public License for more details.
.PP
You should have received a copy of the \s-1GNU\s0 General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.SH "DEPENDENCIES"
.IX Header "DEPENDENCIES"
\&\fBparallel\fR uses Perl, and the Perl modules Getopt::Std, IPC::Open3,
Symbol, IO::File, \s-1POSIX\s0, and File::Temp.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fBfind\fR(1), \fBxargs\fR(1)