porch
, rporch
— Utility to orchestrate command line
tools
porch |
[-f scriptfile]
[command [argument ..]] |
rporch |
[-e rsh]
[-f scriptfile]
[host] |
The porch
utility allows scripted
interactions with other command line tools.
All uses of porch
follow a specific
pattern: spawn a command, optionally write to its stdin, check for patterns
in its stdout. The last two steps may be interleaved in interesting ways
based on program behavior and interaction. When
porch
spawns a command, it sets up a new
pts(4) and
disables input echo on it. The command is not executed immediately, but
instead waits for a release from the user script before processing. This is
done so that the scriptfile may queue up some input to
the program before it begins execution. See
orch(5)
for more detail on porch
scripts.
The following options are available for both
porch
and rporch
:
-f
scriptfile
- Uses the named scriptfile as the script to execute.
Specifying “-” directs
porch
to read
the script from stdin, and is the default behavior.
-h
- Show a usage statement.
The following options are available for
rporch
only:
-e
rsh
- Execute the specified rsh program when spawning a
command.
If a command is specified, then
porch
will spawn it before executing the specified
scriptfile. Execution will still be stalled until
released, as described above.
The rporch
program is used to execute the
scriptfile against programs on a remote host. The
script is still primarily run on the executing host, but any spawned
commands will be executed via the remote shell specified, in order of
preference, by either the -e
argument or the
PORCH_RSH
environment variable. If neither of these
are set, “ssh” will be used. The specified rsh string will be
subjected to word-splitting, and some naive quote handling will be
employed.
PORCH_RSH
- The remote shell progran to use for
rporch
connections.
The porch
utility exits 0 on success, and
>0 if an error occurs. A match
() block failing is
considered an error, unless it is within a one
()
block. All blocks in a one
() block must fail to be
considered an error.