COHERENT manpages
This page displays the COHERENT manpage for uux [Execute a command on a remote system].
List of available manpages
Index
uux -- Command
Execute a command on a remote system
uux [-a user] [-rnpz] command-string
The command uux spools command-string for execution on a remote system.
Usually, it is invoked by software systems, in particular the mail system,
to request that work be performed on a remote system. However, you can
also invoke uux by hand to execute a task on a remote system.
For security reasons, you can execute on the remote system only the
commands that the remote system permits explicitly. These commands are
named in the entry for your system in the remote system's copy of
/usr/lib/uucp/sys.
If all permissions are in order, uux creates a file with the prefix X. in
the remote system's directory /usr/spool/uucp/yoursystem, where yoursystem
is the name by which the remote system knows your system. This file is
then executed by the remote system's copy of the command uuxqt.
command-string consists of a command name followed by zero or more
arguments. Both the command's name and the arguments may be prefixed by a
system name (sitename) and an exclamation mark. Note that all special
characters must be escaped or enclosed in quotation marks to avoid being
processed by your system's shell.
For example, the simplest form of the uux command is:
uux host!command arg0 ... argN
where host is the name of the remote system being contacted, as defined in
file /usr/lib/uucp/sys, command is the name of the command to execute on
the remote system, and arg0 through argN are the arguments to command.
If an argument names a file, that file can reside on the remote system, on
your system, or on some third system. For example, the command
uux widget!lp /usr/sally/herfile
asks site widget to print its own file /usr/sally/herfile. On the other
hand, the command
uux widget!lp !$HOME/myfile
requests that site widget print on its line printer the file myfile from
your home directory on your home system. Note that the `!' that prefixes
myfile is shorthand for the name of your system. Finally, the command
uux widget!lp lepanto!/usr/fred/hisfile
requests that system widget print file /usr/fred/hisfile, which resides on
the third site lepanto. If widget does not know how to contact site
lepanto, the command fails.
If you wish, you can embed the shell operators `<', `>', `;', or `|'
within a uux command. This lets you construct a more powerful command than
you could do otherwise. Commands that contain these operators must be
quoted, to ensure that your shell does not interpret them. For example,
the command
uux "widget!pr /usr/sally/herfile > lepanto!~/fred/hisfile"
tells uux to use pr to format its file /usr/sally/herfile, and write the
output into file /usr/spool/uucppublic/fred/hisfile on site lepanto. (Note
that the tilde `~', as always, is a synonym for the home directory of the
user that is executing the command; and a uux command is always executed by
user uucp whose home directory is always /usr/spool/uucppublic.) Again, the
command fails if you do not have appropriate permissions on widget or if
widget does not have appropriate permissions on lepanto.
The operator `-' lets you use the standard input when constructing a uux
command. For example, the command
who | uux - widget!lp
executes the who command on your system, pipes the output to uux, and tells
uux to invoke the command lp on remote system widget to print the list of
users on your system.
uux attempts to transfer any needed input files to the system that will be
executing the requested command. You must enclose in parentheses any
output files generated by command, to distinguish them from the names of
input file.
Command-line Options
uux recognizes the following options:
-a address
Report the status of the job to address.
-C Copy local files to the spool directory.
-c Do not copy local files to the spool directory. This is the default.
If the files are removed from their local directory before uucico
processes them, the copy fails. The files must be readable by the
uucico as well as the by the user who invokes uux.
-g grade
Set the grade of the file-transfer command. grade is a single ASCII
character, from `0' to `z'; the lower the ASCII value of grade, the
more important the files.
-I file
Read configuration information from file instead of from the default
file /usr/lib/uucp/sys.
-j Print job identifiers on the standard output. uux creates a job
identifier for each file-copying operation required to perform the
operation. To cancel the copying of a file, pass the job identifier
to the uustat with its option -k.
-l Link local files into the spool directory. If a file cannot be linked
because it is on a different device, it is copied unless the -c option
also appears (in other words, use of -l switches the default from -c
to -C). If the files are changed before uucico processes them, the
changed versions will be used. The files must be readable by the
uucico as well as by the user who invoked uux.
-n Do not send mail about the status of a job, even if it fails. The
default is to send mail to the requester should the command fail.
-
-p Read the standard-input device and pipe what is read into the command
to be executed.
-r Queue the uux request but do not invoke uucico to perform the
transfer. The default is to initiate uucico.
-x event
Log each event in the execution of uux, where event is one of the
following values: abnormal, config, spooldir, or execute. A -x option
can hold multiple events, each separated by commas; and a uux command
line can hold more than -x option.
-z Notify requester should command-string fail.
Examples
The following script prints files on a remote system. The files named on
the command line are sent unprocessed to system prnsrvr to be printed
through that system's version of command lp. Option -r tells uux not to
invoke uucico immediately, but merely spool the request for execution
later.
for i in $*
do
uux -r prnsrvr!lp !$i
done
Please note that the `!' that prefixes string ``!$i'' indicates that the
file to be printed resides in the current directory on your home system.
The next example copies file /foo from system george and file /bar from
system norm to your system and then invokes command cmp to compare their
contents. It writes the results of the comparison into file
/tmp/cmp.results on your local system:
uux -z "!cmp -l george!/foo norm!/bar >/tmp/cmp.results"
This command assumes that your system can talk to both george and norm, and
that your system has permission to read file /foo on system george and file
/bar on system norm. Option -z tells uux to send you mail when it has
successfully completed the job.
The last example compiles file mycode.c on system cserver. The command
redirects all of the compiler's error messages into file /tmp/errors on
your local system:
uux 'cserver!cc -O -o (!mycode) !mycode.c > !/tmp/errors'
Note that the name of the output file !mycode is enclosed within
parentheses. This is to protect the `!' from being interpreted by uux; it
will be interpreted by uuxqt on the remote system.
See Also
commands,
UUCP,
uuxqt
Notes
You cannot pipe the output from a command on one system into a command on
another. If command-line consists of several commands that are connected
by pipe characters `|', only the first can be prefixed by a system name and
`!'; every other command within the pipeline will be executed on the system
named by the first command. For example, consider the command:
uux "mwc!wrap -w80 -t4 < !myfile.c | prps | lp"
This command passes file myfile.c from the current directory on your
current system to command wrap on system mwc for processing; then pipes the
output of wrap into prps on system mwc for transformation into PostScript;
and then pipes the output of prps into lp, again on system mwc, for
printing. If you embed a `!' within the subsequent commands of a pipeline,
uux will expand it into something quite unexpected (and probably
unwelcome).
It is not a good idea to use the metacharacter `*' within command-line. The
odds that it will be expanded into what you want are very small.
Every command that you spool with uux is executed within a special
execution directory on the remote system. (Under COHERENT, this directory
is /usr/spool/uucp/.Xqtdir; it may vary on other systems.) Before it
executes the command, UUCP copies into that special directory each file
that the command names, unless that file already resides on the system
within which the command is being executed. For this reason, each file
named in a uux command must be unique, regardless of its full path name.
For example, the following command will not work:
uux "marian!diff fred!/x/testfile ivan!/y/testfile > !xyz.diff"
It fails because uux (or, to be more accurate, uuxqt) copies file testfile
from system fred into its execution directory, then copy testfile from
system ivan into the test directory. The second copied testfile overwrites
the first, and thus the command diff fails.
uux was written by Ian Lance Taylor (ian@airs.com).