HPlogo Configuring and Managing MPE/iX Internet Services: HP 3000 MPE/iX Computer Systems > Chapter 6 REMSH Service

Using remsh

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

The remsh service is accessed by running the REMSH.NET.SYS program. You may do so under the MPE/iX CI or under the POSIX shell. While the format of the commands will differ depending on how you run the program, the parameter list remains the same.

For the purposes of explaining the parameters, look at a sample invocation from the POSIX shell. Detailed examples of both the POSIX shell and MPE/iX invocations will follow later.

From the POSIX shell, invoke the remsh by typing:

/SYS/NET/REMSH remotehost -1 remoteuser remotecommand

In all cases you must provide a remotehost and a remotecommand. The remsh program will fail and generate an error message otherwise. Unless the remote system has MPE/iX type userids, you will also need to provide a -l remoteuser parameter as well. Otherwise the remote system will not allow the connection.

The name of the remote host you are attempting to connect to is remotehost. The host name can be either the official name or an alias as understood by gethostbyname().

The userid is remoteuser on the remote system.

NOTE: The traditional UNIX implementation of remsh makes the -l remoteuser parameter optional. If you do not provide a -l remoteuser parameter, remsh takes your current userID and assumes that you wish to connect to the same userID on the remote system. Since the MPE version of the userID is USER.ACCOUNT, and the UNIX equivalent is user, it is unlikely that you will find a user on the remote system to match your id. We recommend that you always provide the -l remoteuser argument to remsh.

The remotecommand is the command the user wishes to execute on the remote machine. This command may be a CI command, a program (that meets certain criteria) or a shell script. If remotecommand is not specified, remsh will terminate and provide a usage message.

NOTE: remsh cannot be used to run commands that require a terminal interface (such as vi) or commands that read their standard error (such as more).

MPE/iX Examples

To run remsh from MPE/iX prompt, type:

run remsh.net.sys;info="remotehost -l remoteuser remotecommand"

jhereg(PUB): run remsh.net.sys;info="taltos -l cawti pwd " /u2/home/cawti
END OF PROGRAM
jhereg(PUB):

POSIX Examples

From the POSIX Shell prompt, type:

/SYS/NET/REMSH remotehost -l remoteuser remotecommand
shell/iX> /SYS/NET/REMSH taltos -l cawti pwd
/u2/home/cawti
shell/iX>

There are a number of shell features that can be taken advantage of, while running under the POSIX shell.

Shell metacharacters that are not quoted are interpreted on the local host; quoted metacharacters are interpreted on the remote host. Thus the command line:

/SYS/NET/REMSH taltos -l cawti cat remotefile >> localfile

appends the remote file remotefile to the local file localfile, while the command line:

/SYS/NET/REMSH taltos -l cawti cat remotefile ">>" otherremotefile

appends remotefile to the remote file otherremotefile.

The following command line runs remsh in the background on the local system, and the output of the remote command comes to your terminal asynchronously:

/SYS/NET/REMSH otherhost -l remoteuser  -n remotecommand &

The following command line causes remsh to return immediately without waiting for the remote command to complete:

/SYS/NET/REMSH otherhost -l remoteuser "remotecommand 1>&- 2>&- &"

remsh was written so that if the first parameter in its argument vector is not remsh, it will use the value as a host name. So you may symbolically link the host name to the remsh program. A typical BSD UNIX implementation will have these links under the /usr/hosts directory.

If you have made a symbolic link to the remsh program that is the host name, for example you have already entered, (ln -s /SYS/NET/REMSH taltos in our examples), you could simply generate the same result as the first example with the following:

shell/iX>taltos -l cawti pwd /u2/home/cawti shell/iX>
Feedback to webmaster