Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

telnet in DCL script

GNJ
Advisor

telnet in DCL script

Hi
I have few vms nmachines with a user which is common for them and password also same.
I preparing a script to login to these machines using telnet and to do some activities and come out.
How to achieve telnet in script? I know how to do it in shell scripting in unix ? how to do it in dcl? Plese give example
as I am new to dcl scripting and in learning stage

Thanks & Regards
Jayakrishnan G Naik
6 REPLIES
Heinz W Genhart
Honored Contributor

Re: telnet in DCL script

Hi Jayakrishnan

Do the following within your DCL Commandprocedure

$ DEFINE/USER SYS$INPUT SYS$COMMAND
$ Telnet 'host'

This should help

Regards

Heinz
Steve-Thompson
Regular Advisor

Re: telnet in DCL script

good morning Jayakrishnan

I would suggest an alternative, as you know something about unix, the "R" commands exist on VMS and might simplify your task.

ie.
$ rsh other_node @script

Test to see if this command is available with
$rsh same_node show time
and
$rsh other_node show time.

If these commands work, fine if not theres a few steps to be done to get it working.
Let me know.

Steven
Daniel Fernandez Illan
Trusted Contributor

Re: telnet in DCL script

Hi Jayakrishnan

I would suggest two options for work using proxies facilities:

First case:
Using DECnet proxies defined to common user between master and slaves machines, you can execute a script with activities to execute i.e.
MASTER>@SLAVEn::script.com
with script.com copied on sys$login directory of common user in SLAVE1,2,3... nodes
$!script.com
$sho time
$dir *.com
...
$exit

Second case:
Using TCP/IP proxies defined to common user on slaves machines and using rsh facilities as Steven said.

Saludos.
Daniel.
labadie_1
Honored Contributor

Re: telnet in DCL script

Have a look at

Telnet Client Accepting Non Interactive Commands


http://h18000.www1.hp.com/support/asktima/appl_tools/009E60A3-96F8B0
E0-1C0186.html

It works fine.
GNJ
Advisor

Re: telnet in DCL script

HI Heinz
I didnt understood ur reply.
Can you clarify this for me?
what this does?
where I have to keep the username and password in the script?
etc....

"$ Define/user sys$input sys$command
$ telnet host"


Regards
Jay
Heinz W Genhart
Honored Contributor

Re: telnet in DCL script

Hi Jayakrishnan

If a commandfile executes sys$input points to the commandfile itself.

$ DEFINE/USER SYS$INPUT SYS$COMMAND
$ TELNET 'host'

The first line redefines SYS$INPUT for only the next time SYS$INPUT is used (/USER).

If You do a telnet within your Commandfile without the line '$ define/user ...' you will never be able to enter a Username and a password.

But I dind not understand your question correctly in the beginning and so my answer is of no use in this case.


I think another possibility to solve a problem like this is to use task-task communication.


On Node B (there where you like to do something) you could have a commandprocedure like this:

B.COM
$ OPEN/READ in SYS$NET
$ READ in record
$ 'record'
$ CLOSE in
$ EXIT

On node A (There where you start the whole thing) You can have a procedure similar to this:

A.COM
$ READ/PROMPT="Enter Username on node B " SYS$COMMAND username
$ SET TERMINAL /NOECHO/PERMANENT
$ READ/PROMPT="Enter Password for ''username' on Node B" SYS$COMMAND password
$ SET TERMINAL/ECHO/PERM
$ WRITE SYS$OUTPUT ""
$ OPEN/WRITE remote nodeb"''username' ''password'::"0=B.COM"
$ WRITE remote "command to execute on node B"
$ CLOSE remote

You must extent the procedures so that they fit your needs.


Another Possibility would be to use SSH. With SSH you can execute a command or a commandfile on a remote node. If you would use private and public key authentication then you can organize it, that you dont have to supply a password.

$ SSH username@nodeb DCL-Command-to-execute-on-node-B

Or You can use RSH as suggested by 24x7

I would assume that the solution of Daniel will not work, because:

IF you do something like @nodeb::test.com

then test.com resides on nodeb, but the commandfile will be executed on nodea. To test this write a commandfile with one line

test.com
$ WRITE SYS$OUTPUT F$GETSYI("NODENAME")

Copy this file to nodeb and the enter on nodea @nodeb::test

It will write the nodename of nodea on your screen.

Hope that helps

Regards

Heinz