Hello Scott,

Thankyou very VERY much for your help........solved at last. :-)
Wish I'd posted earlier and saved myself some hassle.

Thankyou

Regards
Andy

Martin Dawes Systems
t. 01925-55-5316
e Andrew_Smith@xxxxxxxxx
w. www.martindawessystems.com



Scott Klement <midrange-l@xxxxxxxxxxxxxxxx>
03/11/2011 17:43

To
Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
cc
Andrew.Smith@xxxxxxxxx
Subject
Re: Submit SSH Command to submit remote command with Parameters






Hiya Andrew,

I would add the -n switch to the ssh command. That tells it not to
attempt to get input from stdin (which, in your example, would be the
keyboard -- and that might cause problems in batch!)

I would also add (at a minimum) the QIBM_QSH_CMD_OUTPUT environment
variable to tell QShell to write the output to a log file instead of the
user's screen. and the QIBM_QSH_CMD_ESCAPE_MSG to help you detect errors.

PGM
DCL VAR(&CMD) TYPE(*CHAR) LEN(1000)

ADDENVVAR ENVVAR(QIBM_QSH_CMD_ESCAPE_MSG) VALUE(Y) +
REPLACE(*YES)

ADDENVVAR ENVVAR(QIBM_QSH_CMD_OUTPUT) +
VALUE('FILE=/tmp/sshcmd.log') +
REPLACE(*YES)

CHGVAR VAR(&CMD) VALUE('ssh -T SFTPTST@xxxxxxxxxxxxxx +
''system "sbmjob cmd(CALL PGM(QGPL/XXXXXXX) +
parm(''DANNYT'' ''Joe.Blogs@xxxxxxxxxxxxxx'')) +
job(SRVDPRF) HOLD(*YES) JOBQ(QBATCH) "''')

QSH CMD(&CMD)
MONMSG MSGID(QSH0000) EXEC(DO)
SNDMSG MSG('Command failed! See /tmp/sshcmd.log') +
TOUSR(*REQUESTER)
ENDDO

ENDPGM

-then-

SBMJOB CMD(CALL THE-ABOVE-PGM) JOB(SRVDPRF) JOBQ(QBATCH)



On 11/3/2011 9:45 AM, Andrew.Smith@xxxxxxxxx wrote:
Hello,

I trying to submit a job on the iSeries to submit a remote command on
the
target iSeries passing in parameters but I am hitting a brick wall :-(

My CL does this

QSH CMD(&COMAND) and the parameter&COMAND is this

ssh -T SFTPTST@xxxxxxxxxxxxxx 'system "sbmjob cmd(CALL PGM(QGPL/XXXXXXX)
parm('DANNYT' 'Joe.Blogs@xxxxxxxxxxxxxx')) job(SRVDPRF) HOLD(*YES)
JOBQ(QBATCH) " '

This works fine and submits the job on the target machine....but I have
to
press enter on my machine to close the terminal session. So I tried to
submit the job on my machine so it could run in batch

CALL PGM(QCMDEXC) PARM(&COMAND&LENGTH)

but this time&COMAND looks like this

SBMJOB CMD(QSH CMD ('/QOpenSys/bin/ssh -T SFTPTST@xxxxxxxxxxxxxx 'system
"sbmjob cmd(CALL PGM(QGPL/XXXXXXX) parm('DANNYT'
'Joe.Blogs@xxxxxxxxxxxxxx')) job(SRVDPRF) HOLD(*YES) JOBQ(QBATCH) " ''))
job(SRVDPRF) HOLD(*YES) JOBQ(QBATCH)

But I cannot get this to work......can anyone help please.....I've
pulled
out to much hair on this already :-(

Thankyou

Regards
Andy

Martin Dawes Systems
t. 01925-55-5316
e Andrew_Smith@xxxxxxxxx
w. www.martindawessystems.com


________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.