hostlist
hostlist [ -g hostgroupname{[,hostgroupname]} ][ -l ]
hostlist -p
hostlist -i | -y | -j
The intention is, that the output generated by hostlist is used as input for scripts or commands which compute commands/jobs on this list of hosts. Therefore there is only one source list of hosts being part of an environment and when a host is added/removed to/from it, only the edrc/etc/hostlist.cfg configuration file has to be adjusted and not all scripts which have to deal with a list of hosts.
hostlist can be used together with the server_environment(3) command in the configuration file edrc/etc/hostlist.cfg to enable hostlist to return the list of hosts that are part of a certain named server environment. E.g. the list of hosts in the PRODUCTION environment is different from the list of hosts in the DEVELOPMENT environment for an enterprise. See hostlist.cfg(4) for more information.
To compute different sets of hosts as returned by a call of hostlist, it is possible to define groups of hosts that can be accessed via a hostgroupname. This enables the abstraction of a group of hosts to a group name ( @HOSTGROUP ).
On complex configurations the resolution performance might decrease. To avoid this, the resolution cache can be used ( CACHE=True in edrc/etc/hostlist.cfg ). The cache data depends on the timestamps and filesizes of a configurable set of files ( CACHE_DEPENDENCY= file_1 file_2 ... file_n-1 file_n ), the hostlist(3) and server_environment(3) command files, and the hostname as resolved by hostname(1). The resolution cache is read/write for the WA2L/edrc owner and read only for all other users.
The HOSTGROUPs having a name starting with an underscore ( _ ) should *not* be used interactively, due to the fact that the convention is, that those HOSTGROUPs are used internally within configuration files only.
The HOSTGROUPs having a name starting with an underscore ( _ ) are HOSTGROUPs that are used internally in WA2L/edrc within configuration files.
The HOSTGROUPs having a name starting with an underscore ( _ ) are HOSTGROUPs that are used internally in WA2L/edrc within configuration files.
The HOSTGROUPs having a name starting with an underscore ( _ ) are HOSTGROUPs that are used internally in WA2L/edrc within configuration files.
[ /home/wilma ] [ wilma@adm_db1_prod ][-ksh]: ~edrc/lib/hostlist dcdbsi20 dcdbsi21 dcdbsi30 dcdbsi31 dcdbsi32 dcdbsi33
[ /home/wilma ] [ wilma@adm_db1_prod ][-ksh]: ~edrc/lib/hostlist -g @ADM adm_db1_mnt adm_db1_tst adm_db1_pre adm_db1_prod
The use of hostlist in configuration files eases the configuration due to the fact that the target list of hosts can be centralized to one single configuration file ( the edrc/etc/hostlist.cfg file ) and changes in the server environment will be propagated to all tools used.
Example of the use of hostlist in the edrc/etc/edrc.cfg configuration file:
: : # Space separated list of hosts. To this hosts # the files in SCRIPTS_BASEDIR will be distributed. # DIST_HOSTLIST="`hostlist -g @_DIST`" : :
Example of the use of hostlist in the edrc/etc/passwdsyncd.cfg configuration file:
: : # Space separated list of hosts. To this hosts # the password information will be distributed. # SYNC_HOSTLIST="`hostlist`" : :
Print uptime of all systems in a server environment.
: : targets=`hostlist -l` rcmd -n -t $targets -c "sysinfo -u" | sort : :
This is free software; see edrc/doc/COPYING for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.