man nodeattr (Commandes) - query genders file

NAME

nodeattr - query genders file

SYNOPSIS

nodeattr "[-f genders] [-q | -c | -n | -s] attr[=val]

nodeattr "[-f genders] [-v] [node] attr[=val]

nodeattr [-f genders] -l [node]

nodeattr [-f genders] -k

DESCRIPTION

When invoked with the -q , -c , -n , or -s arguments, nodeattr reads the genders file and outputs a list of nodes that have the specified attribute. The nodes are listed in hostlist format, comma separated lists, newline separated lists, or space separated lists.

When called with a node name (optional) and attribute name, nodeattr returns 0 to the environment if the node has the attribute; else 1. If -v is present, the attribute name and any value (see below) is printed on the standard output. If a node name is not specified, the local host is assumed.

The -l option causes nodeattr to print the attributes of the specified node. If no node is listed, all attributes in the genders file are listed.

The -k option checks the genders file for proper formatting. Information about improper formatting will be output to standard error.

Nodeattr will always check the default genders file, but a different genders file can be specified with the -f option.

Attribute names may optionally appear in the genders file with an equal sign followed by a value. Nodeattr ignores these values except when the -v option requests that the value, if any, be displayed; and when an attribute is specified on the command line with a value, in which case only an attribute with the specified value in the genders file will match.

EXAMPLES

To use nodeattr with dsh to run a command on all fddi nodes:

pdsh -w`nodeattr -c fddi` command

To use nodeattr in a ksh script to collect a list of users on login nodes:

for i in `nodeattr -n login`; do rsh $i who; done

To verify whether or not this node is a head node:

nodeattr head && echo yes

FILES

/etc/genders

SEE ALSO