SUT Home

ptpred

SUT predicate

Description

ptpred executes test (1) on specified machines and outputs a hostname followed by a given string based on the result of the test on that host.

Command Line Arguments

ptpred [-all|-m <machine_file>|-M <machine_list>] <arguments to test> [<then clause>] [<else clause>]

-m <machine_file>
Specify a file with a list of destination machines. It is incorrect to use this with the -M option. This option must preceed all others.

-M <machine_list>
Specify a list of destination machines. The entire list must be surrounded by quotes. It is incorrect to use this with the -m option. This option must preceed all others.
<arguments to test>
the arguments to pass to test
<then clause>
the string to print if test returns 0 on the given node. If this is not specified, it is assumed to be "1".
<else clause>
the string to print if test does not return 0 on the given node. If this is not specified, it is assumed to be "0".

Environment Variables

PT_MACHINE_FILE
If PT_MACHINE_FILE is set, the command will attempt to open the file whose name is stored in PT_MACHINE_FILE. This will be used if neither the -m or -M options are given.

Examples

To test for the existence of the file /home/johndoe/myfile on the machines specified in the file "destination_machines" use

ptpred -m destination_machines -f /home/johndoe/myfile

To do the same test, specifying machines on the command line, use

ptpred -M "host1 host2 host3" -f /home/johndoe/myfile

The output from this command might look like the following:

host1.domain.tld: 0
host2.domain.tld: 1
host3.domain.tld: 0

In this case, /home/johndoe/myfile exists only on host2.

To test on similarly named hosts as in the previous example, an abbreviation can be used

ptpred -M "host%d@1-3" -f /home/johndoe/myfile

where the %d is replaced by the numbers 1-3 when the test is performed.

See Also

test(1), ptdisp(1), SUT(1)







Contact Emil Ong about issues concerning this page.