.\" $HeadURL$ $LastChangedRevision$ .\" .pso ade-config --format=man .so \*[ade_include_prefix]/ade.man .pso rocon-config --format=man .TH ROCON 1 "ADE_APP_TOKEN_RELEASE_DATE_MAN" .SH NAME rocon \- run commands on clusters .br .ne 5 .SH SYNOPSIS .B rocon \*[ade_standard_synopsis_component] [ .B \-f .I file | .B \-\-config\-file=\fIfile\fR ] [ .B \-\-refresh ] [ .B \-q | .B \-\-quiet ] [ .B \-\-ssh=\fIcommand\fR ] [ .B \-t .I timeout | .B \-\-timeout=\fItimeout\fR ] [ .B \-u ] { .B \-c .I command | .B \-e | .B \-g | .B \-m | .B \-w } .I host\-selector\-expression .br .ne 5 .SH DESCRIPTION .B Rocon runs a specified command on a set of remote machines using .B ssh\fR(1) or lists that set of machines. The set of machines is determined by the contents of a configuration file and by .I host\-selector\-expression\fR. .PP .I host\-selector\-expression is a space-separated sequence of hostnames, hostgroup names and the combining tokens .B \fR'\fBand\fR', '\fBor\fR', '\fBnot\fR', '\fB(\fR' and '\fB)\fR'. .PP In addition, .B rocon can invoke an editor to edit the configuration file, write the contents of the configuration file to standard output and display a list of known hostgroups. .br .ne 5 .SH CONFIGURATION The configuration file consists of lines which are either hash-led comments or host records. Host records are of the format: .PP .nf .fam C \fIhostname\fR:\fIhostgroup1\fR,\fIhostgroup2\fR,...:\fIfreefield1\fR:\fIfreefield2\fR... .fam T .fi .PP where .I hostname is the name of a machine in the cluster and .I hostgroup1\fR, etc are arbitrarily named groups to which the specified host belongs. The group names are strings conformant with the usual rules for hostnames (i.e. must consist of only letters, numbers, underscores and hyphens and must begin with a letter). Any number of fields after a second colon may be present but are ignored by .B rocon\fR; this is intended to facilitate using the configuration file also for other purposes. .PP Some consideration should be given to naming hostgroups; however, some guidelines can be applied: .TP \(bu create a group to which all hosts belong (e.g. .B AllHosts\fR) .TP \(bu use caps-led names or suffix the group names with .B Hosts (e.g. .B SolarisHosts\fR) in order to make it easy to distinguish hostnames from hostgroup names on the command line .TP \(bu include hosts in a set of hostgroups with increasing specialisation, e.g.: .RS 5 .IP .nf .fam C .B mickey:AllHosts,PcHosts,PcDellHostsLinuxHosts,DebianHosts,Debian31Hosts::: .fam T .fi .br .RE .ne 5 .SH OPTIONS \*[ade_standard_options_component] .TP .B \-c \fI command Runs the specified command on the set of remote machines specified by .I host\-selector\-expression\fR using .B ssh\fR(1). .TP .B \-e Edit the configuration file. .TP .B \-f \fIfile\fR,\fB \-\-config\-file=\fIfile\fR Specify an alternate configuration file. .TP .B \-g List known hostgroups. .TP .B \-m Display the set of machines specified by .I host\-selector\-expression\fR. .TP .B \-q\fR, \fB\-\-quiet\f When using the .B \-c option, suppress the .I hostname\fB:\fR line prefix if there is no output from the command. .TP .B \-\-refresh Force refresh of the cache. Ordinarily .B rocon manages the cached compiled configuration data itself and this option is not needed. However if old versions of the configuration are restored then it may be impossible for .B rocon to determine that its cache is stale and needs refreshing. In such circumstances this option will force the cache to be refreshed. .TP .B \-\-ssh=\fIcommand\fR Specify path to the .B ssh\fR(1) command. The default is to rely on .B $PATH to find it. .TP .B \-t \fItimeout\fR,\fB \-\-timeout=\fItimeout\fR When using the .B \-c option, wait a maximum of .I timeout seconds for .I command to complete; the default is 0, which means no timeout is applied. .TP .B \-u Further limits .B rocon\fR's activities to apply only to hosts which are up. .TP .B \-w Writes the config file to standard output. .br .ne 5 .SH EXIT STATUS On success .B rocon returns zero. On failure it returns non-zero and displays a diagnostic message. .br .ne 5 .SH FILES .TP .B \*[rocon_etc_prefix]/rocon.conf Default configuration file; see also .B OPTIONS above. .br .ne 5 .SH ENVIRONMENT VARIABLES .TP 25 .B EDITOR command to be invoked when .B rocon called with .B \-e option. The default is .B vi\fR(1). .TP .B PATH used to find several commands including .B ssh\fR(1). .br .ne 5 .SH EXAMPLES Given a host information file in the default location containing: .IP .nf .fam C .B mickey:AllHosts,PcHosts,PcDellHostsLinuxHosts,DebianHosts,Debian31Hosts::: .B pluto:AllHosts,HpHosts,HpC110Hosts,HpuxHosts,Hpux11Hosts::: .B donald:AllHosts,HpHosts,HpC110Hosts,LinuxHosts,DebianHosts,Debian31Hosts::: .B goofey:AllHosts,SunHosts,SunUltraHosts,LinuxHosts,DebianHosts,Debian31Hosts::: .B dumbo:AllHosts,SunHosts,SunUltraHosts,SolarisHosts,Solaris8Hosts::: .fam T .fi .PP To get the uptime for all hosts in the hostgroup 'HpHosts' except those running Linux run: .IP .nf .fam C .B rocon -c uptime HpHosts and not Linux .fam T .fi .PP To remove any existing reboot from root's crontab and replace it with a reboot at 02:00 every Sunday morning on all machines except dumbo run: .IP .nf .fam C .B rocon -c '{ crontab -l | grep -v shutdown; echo \[dq]0 2 * * 1 shutdown -r -y now\[dq]; } > /tmp/newcrontab; crontab - < /tmp/newcrontab' AllHosts and not dumbo .fam T .fi .PP For those without a better way to control the system time, don't run the following because it is too slow and, depending on the number of hosts in 'AllHosts', can result in a significant time difference between the first and last hosts on the list: .IP .nf .fam C .B rocon -u -c 'date 1227' AllHosts .fam T .fi .PP Instead run the following: .IP .nf .fam C .B rocon -u -m AllHosts | xargs -i sh -c 'ssh {} date 1227 &' .fam T .fi .br .ne 5 .ne 5 .SH CAVEATS Because of the format in which the configuration is cached, hostnames and hostgroup names may not be SQL keywords; see http://www.sqlite.org/lang.html for a list of these. This restriction is considered a bug. .PP Beware of local policies regarding the editing of the configuration file (e.g. with the .B \-e option); it may be that the configuration file is generated from another database and that manual edits will be lost: seek advice locally. .br .ne 5 .SH STANDARDS This manual page documents version ADE_APP_TOKEN_RELEASE_ID of .B rocon\fR. .br .ne 5 .SH SEE ALSO rocon-config(1), ssh(1), vi(1), http://www.sqlite.org, RFC952 .br .ne 5 .SH AUTHOR ADE_APP_TOKEN_AUTHOR_NAME .br .ne 5 .SH COPYRIGHT & DISTRIBUTION POLICY Copyright (C) 1995-ADE_APP_TOKEN_RELEASE_YEAR ADE_APP_TOKEN_AUTHOR_NAME \*[ade_standard_copyright_component]