1NODEATTR(1) NODEATTR NODEATTR(1)
2
3
4
6 nodeattr - query genders file
7
9 nodeattr [-f genders] [-q | -c | -n | -s] [-X exclude_query] query
10 nodeattr [-f genders] [-q | -c | -n | -s] -A
11 nodeattr [-f genders] [-v] [node] attr[=val]
12 nodeattr [-f genders] -Q [node] query
13 nodeattr [-f genders] -V [-U] attr
14 nodeattr [-f genders] -l [node]
15 nodeattr [-f genders] -k
16 nodeattr [-f genders] -d genders
17 nodeattr [-f genders] --expand
18 nodeattr [-f genders] --compress
19
21 When invoked with the -q , -c , -n , or -s arguments, nodeattr reads
22 the genders file and outputs a list of nodes that match the specified
23 query. The nodes are listed in hostlist format, comma separated lists,
24 newline separated lists, or space separated lists respectively. Gen‐
25 ders queries will query the genders database for a set of nodes based
26 on the union, intersection, difference, or complement of genders
27 attributes and values. The set operation union is represented by two
28 pipe symbols ('||'), intersection by two ampersand symbols ('&&'), dif‐
29 ference by two minus symbols ('--'), and complement by a tilde ('~').
30 Parentheses may be used to change the order of operations. The -X
31 argument and query can be used to exclude nodes from the resulting out‐
32 put. A query can be replaced with the -A option to cause nodeattr to
33 print all the nodes listed in the genders database.
34
35 When called with a node name (optional) and attribute name, nodeattr
36 returns 0 to the environment if the node has the attribute; else 1. If
37 -v is present, the attribute name and any value (see below) is printed
38 on the standard output. If a node name is not specified, the local
39 host is assumed.
40
41 When called with the -Q argument, nodeattr will check if the node name
42 (optional) is met by the attribute and value conditions specified in
43 the query. If the conditions are met, nodeattr returns 0 to the envi‐
44 ronment; else 1. The query format is identical to the format listed
45 above. If a node name is not specified, the local host is assumed.
46
47 The -V option causes nodeattr to print all of the values that exist for
48 a particular attribute. Also specifing -U with -V causes nodeattr to
49 print out only unique values for the particular attribute.
50
51 The -l option causes nodeattr to print the attributes of the specified
52 node. If no node is listed, all attributes in the genders file are
53 listed.
54
55 The -k option checks the genders file for parse errors and proper for‐
56 matting. If errors are found, information about the error will be out‐
57 put to standard error.
58
59 Nodeattr will always check the default genders file, but a different
60 genders file can be specified with the -f option.
61
62 The -d option allows the specified genders database to be compared to
63 the filename indicated by the -f option or the default genders data‐
64 base. The differences contained in the specified database will be out‐
65 put to standard error.
66
67 The --expand option will take a genders database, expand all hos‐
68 tranges, and output a new genders database. The subsequent database
69 will be identical to the first, but every node will be listed on a sep‐
70 arate line. This option may be useful for debugging or determining the
71 difference between databases.
72
73 The --compress is opposite of the --expand option. It will output a
74 new identical genders database with hostranges of nodes with identical
75 attributes. Depending on the setup of your genders database, the
76 resulting database may be longer or shorter. This option may be useful
77 as a beginning step to compressing an existing genders database.
78
79 Attribute names may optionally appear in the genders file with an equal
80 sign followed by a value. Nodeattr ignores these values except when
81 the -v option requests that the value, if any, be displayed; and when
82 an attribute is specified on the command line with a value, in which
83 case only an attribute with the specified value in the genders file
84 will match.
85
87 Retrieve a comma separated list of all login nodes:
88
89 nodeattr -c login
90
91 Retrieve a hostlist formatted list of all login nodes:
92
93 nodeattr -q login
94
95 Retrieve a comma separated list of nodes with 4 cpus:
96
97 nodeattr -c cpus=4
98
99 Retrieve a comma separated list of all login and management nodes:
100
101 nodeattr -c "login||mgmt"
102
103 Retrieve a comma separated list of all login nodes with 4 cpus:
104
105 nodeattr -c "login&&cpus=4"
106
107 Retrieve a comma separated list of all nodes that are not login or man‐
108 agement nodes:
109
110 nodeattr -c "~(login||mgmt)"
111
112 To use nodeattr with pdsh to run a command on all fddi nodes:
113
114 pdsh -w`nodeattr -c fddi` command
115
116 To use nodeattr in a ksh script to collect a list of users on login
117 nodes:
118
119 for i in `nodeattr -n login`; do rsh $i who; done
120
121 To verify whether or not this node is a head node:
122
123 nodeattr head && echo yes
124
125 To verify whether or not this node is a head node and ntpserver:
126
127 nodeattr -Q "head&&ntpserver" && echo yes
128
130 /etc/genders
131
133 libgenders(3)
134
135
136
137LLNL August 2003 NODEATTR(1)