Troubleshooting
Problem
The document describes how to run CL commands remotely through an SSH connection.
Resolving The Problem
The SSH utility has several switches and parameters that allow you to run a shell command remotely
without first entering the remote shell. The following examples show you a couple of different ways to use this function:
ssh -T barlen2@i5osp2 'system "SBMJOB CMD(CALL PGM(TOOLS/BACKUPLIBS) PARM(*ALL)) JOB(BACKUP)" '
As a result of this command, the shell displays the following i5/OS message that was issued on the remote system:
CPC1221: Job 015242/BARLEN2/BACKUP submitted to job queue QBATCH in library QGPL.
The system command is used in the i5/OS PASE shell to run i5/OS commands.
ssh -T barlen@i5osps2 'system "DSPMSG QSYSOPR" '
As opposed to the first example where you received the message about the submission of the job, the DSPMSG command returns the
output to the source system's i5/OS PASE shell.
Note: These two examples always require you to enter a password when connecting to the remote system. In many cases, this is not desirable because some commands should be run in unattended or batch mode. Automatic sign-on can be achieved with SSH by using public key authentication.
without first entering the remote shell. The following examples show you a couple of different ways to use this function:
- The following command establishes an SSH session under user profile BARLEN2 to the i5OSP2 system and submits a backup job in i5/OS:
ssh -T barlen2@i5osp2 'system "SBMJOB CMD(CALL PGM(TOOLS/BACKUPLIBS) PARM(*ALL)) JOB(BACKUP)" '
As a result of this command, the shell displays the following i5/OS message that was issued on the remote system:
CPC1221: Job 015242/BARLEN2/BACKUP submitted to job queue QBATCH in library QGPL.
The system command is used in the i5/OS PASE shell to run i5/OS commands.
- In this example, the Display Message (DSPMSG) command for displaying the QSYSOPR message queue is run:
ssh -T barlen@i5osps2 'system "DSPMSG QSYSOPR" '
As opposed to the first example where you received the message about the submission of the job, the DSPMSG command returns the
output to the source system's i5/OS PASE shell.
|
Note: These two examples always require you to enter a password when connecting to the remote system. In many cases, this is not desirable because some commands should be run in unattended or batch mode. Automatic sign-on can be achieved with SSH by using public key authentication.
[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CKoAAM","label":"Communications-\u003ESFTP and SSH or Secure Shell"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]
Historical Number
538530884
Was this topic helpful?
Document Information
More support for:
IBM i
Component:
Communications->SFTP and SSH or Secure Shell
Software version:
All Versions
Operating system(s):
IBM i
Document number:
687215
Modified date:
03 June 2024
UID
nas8N1012704
Manage My Notification Subscriptions