CL Command Reference - AREXEC
CL Command List > AREXEC Reference
Description:
The Run Remote Command (RUNRMTCMD) command, also known as AREXEC when an SNA address is specified for the remote location name, allows server users to run a command on a remote system that is running the target portion of this function, AREXECD (APPC remote executing) daemon.
When the command is sent to the remote system, the local system waits for the command to complete and the output from the remote command will be placed in a spooled file.
Examples:
Example 1: Run Remote Command (RUNRMTCMD) Using SNA Address Type
RUNRMTCMD CMD(¡¯dir¡¯) RMTLOCNAME((APPN.RMTSYS *SNA))
This command runs the ¡¯dir¡¯ command on the system specified by ¡¯RMTLOCNAME¡¯ using an SNA address type.
Example 2: Run Remote Command (AREXEC) Using SNA Address Type
AREXEC CMD(¡¯dir¡¯) RMTLOCNAME(APPN.RMTSYS)
This command is equivalent to the command in example 1.
Example 3: Run Remote Command Using IP Address Type and Host Name to Specify Target System
RUNRMTCMD CMD(¡¯ls¡¯) RMTLOCNAME((MYSYS.NET1.LOCAL *IP))
This command runs the ¡¯ls¡¯ command on the system specified by host name
MYSYS.NET1.LOCAL.
Example 4: Run Remote Command Using IP Address Type and Internet Address to Specify Target System
RUNRMTCMD CMD(¡¯ls¡¯) RMTLOCNAME((¡¯9.5.1.94¡¯ *IP))
This command runs the ¡¯ls¡¯ command on the system specified by internet address ¡¯9.5.1.94¡¯.
Example 5: Run Remote Command With Multiple Commands Using IP Address Type and Internet Address to Specify Target System
RUNRMTCMD CMD(¡¯ls; cat myfile; date¡¯) RMTLOCNAME((¡¯9.5.1.94¡¯ *IP))
This command runs multiple commands, first ¡¯ls¡¯, then ¡¯cat myfile¡¯, then ¡¯date¡¯ on system specified by internet address ¡¯9.5.1.94¡¯.
Example 6: Run Remote Command With a Wait Time Expiration Value
RUNRMTCMD CMD(¡¯dir¡¯) RMTLOCNAME((APPN.RMTSYS *SNA)) WAITTIME(15)
This command runs the ¡¯dir¡¯ command on the specified system. The maximum wait time for the remote location to respond is 15 seconds. A wait time is only allowed when using *SNA address type value.