View previous topic :: View next topic
|
Author |
Message |
yuvan
New User
Joined: 10 Jan 2006 Posts: 23 Location: India
|
|
|
|
Hi Team,
Is it possible to execute a Linux script through a mainframe job , We have installed the Coz SFTP installed in our mainframe and SSH also enabled.
I searched through , but could not find any , Please could you tell the possible options. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
This approach does not use SFTP and I don't think SFTP can run scripts remotely.
Inorder to trigger a Linux script from Mainframe remotely, you would need to have established key based authentication between Mainframe and Linux system.
If you already have public and private keys setup and configured between the systems then its simple.
Code: |
//RUNSHEL1 EXEC PGM=BPXBATCH
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//STDPARM DD *
SH ssh -i /pathofkey/rsa_keyname userid@LINUX_IP 'sh -s' < /pathofscript/hello.sh
/*
or
SH ssh -i /pathofkey/rsa_keyname userid@LINUX_IP 'bash -s' < /pathofscript/hello.sh |
Where
/pathofkey/rsa_keyname - This is Mainframe USS file location of the private key.
userid - UserID on the Linux machine
LINUX_IP - IP address or name of the linux machine
/pathofscript/hello.sh - This file is present in Mainframe and would be transmitted to the Linux machine and the script would run there.
If you don't have public private keys setup then I can go over it. But will wait for a response. |
|
Back to top |
|
|
yuvan
New User
Joined: 10 Jan 2006 Posts: 23 Location: India
|
|
|
|
Not sure SSH key based is setup now .
I just tried with the given JCLs in Dev region , but facing problem in where to add the Linux script /pathofscript/hello.sh .
Tried with the mainframe datasets ,but it says as below.
FSUM7343 cannot open "//XXX.TEST.XXX.JCLS/TESTX" for input: EDC5129I No such file or directory.
Please let us know how to setup if we do not have ssh keys not available. |
|
Back to top |
|
|
yuvan
New User
Joined: 10 Jan 2006 Posts: 23 Location: India
|
|
|
|
Again , I tried with
SH ssh -i /abcusr1/laduser z-kcp-kad@159.15x.xxx.xx 'bash -s' <
/abcusr1/laduser/test.sh
it says
FSUM7343 cannot open "/abcusr1/laduser/test.sh" for input:: EDC5111I Permission denied. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Hello,
The same company that provides Coz SFTP has a product that may be able to do what you need.
//dovetail.com/products/hybridbatch.html
We successfully used this to execute Mainframe SAS programs on Unix servers.
It took us a great deal of time and effort to get it working properly, so I can not just say 'here you go' this is how you should do it.
You will need to contact the company for guidance.
Please note, we 'pay' the company for support. Do not expect them to be diligent with you for free.
I am just directing you to a possible solution. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
Code: |
FSUM7343 cannot open "/abcusr1/laduser/test.sh" for input:: EDC5111I Permission denied.
|
This says you don't have access to this file. Check the unix file permissions for that file |
|
Back to top |
|
|
yuvan
New User
Joined: 10 Jan 2006 Posts: 23 Location: India
|
|
|
|
Now getting below message.
FOTS1273 Warning: Identity file /abcusr1/laduser not accessible: EDC5121I Invalid argument. (errno2=0x055B005B).
FOTS1346 Permission denied, please try again.
FOTS1346 Permission denied, please try again.
FOTS1373 Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
Actual JCL
//RUNSHEL1 EXEC PGM=BPXBATCH
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//STDPARM DD *
SH ssh -i /abcusr1/laduser z-kvc-dev@158.xxx.xxx.xx 'sh -s' <
/abcusr1/test.sh
/* |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
Hello,
Code: |
FOTS1273 Warning: Identity file /abcusr1/laduser not accessible: EDC5121I Invalid argument. (errno2=0x055B005B). |
In your JCL it points to a directory and not a private key file hence the error.
SH ssh -i /pathofkey/rsa_keyname userid@LINUX_IP 'sh -s' < /pathofscript/hello.sh
The text in red above needs to point to a file(not a directory). The file is supposed to contain a private key.
Private key is something that looks like
Code: |
-----BEGIN RSA PRIVATE KEY-----
sdfsdfdsfteraj63WF3Jy0CvUsY6mfRqjP53HuRLe5PElFAbQbUcg
MUOcMeZiFxH+K54ZOcxiagcM+h4hjkswdeyZBpxq9mN2YPwd11ddsfsdfsdfY
.
.
.
-----END RSA PRIVATE KEY----- |
The private key needs to have a permission of 600. And owned by the user initiating the SSH.
You need to take help from a Unix programmer and Mainframe systems programmer to set the keys up. It would be really hard to set it up without their help.
We members of the forum are happy to help you if you encounter more errors Or if you want to take the easy route, I am up for hire at $100 for the whole setup. |
|
Back to top |
|
|
yuvan
New User
Joined: 10 Jan 2006 Posts: 23 Location: India
|
|
|
|
Hi , I am able to run a script with the below option .
//RUNCOZ EXEC PROC=COZPROC,ARGS='unixuserid@111.222.333.4444'
//COZCFGD DD *
//STDIN DD *
uname -norm
date
uptime
pwd
~/scripts/do-tmp-stuff.sh
date
/* |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
Thanks for posting the solution. |
|
Back to top |
|
|
|