[mod.computers.vax] Nifty remote node command command file.

JOHNSON%northeastern.edu@CSNET-RELAY.ARPA (one hot mother) (07/16/86)

     This is a response to a decnet question on the the list.  I 
thought I'd post it to the list as it works very well.
====================================================================
Dave Serafini

     >Does anybody know if it's possible (and if so, if it's
     >been done) to find out some aspect of system status
     >about a remote machine on a DECnet?  What I'm
     >particularly interested in right now is how to find out
     >the state of the print queues on another machine, but I
     >can see this generalizing into any facet of system
     >status.  The ideal would be something fast enough to be
      >interactive, that could return its information to a
     >terminal. 
     >
     >Thanks much. 


     Having trouble getting to you.  This may come in from several
different places.

     Here is a magic command file.  Activate it as follows

     $ @TELL <node>:: <vms command>  for example

     $ @TELL VAXA:: SHO SYS

I just ran it and it still works under vms 4.4.  It works by copying itself 
across the net and running itself as a network task with task-to-task 
communication using SYS$NET:.  Neat.  I got it from someone else.  Have fun
with it.  Look at the code if you have a chance.  It gives insight into 
DECNET workings for those who need it.

     Please not: although this work fine when I do it, and I have reason to 
believe it will work other places too, no warranties of any kind come with it.
==========================cut here=======================================
$ if f$mode() .eqs. "NETWORK" then goto network
$ !
$ ! Execute DCL command(s) in a remote network job - Tim Halvorsen
$ !
$ !	P1 = Node name
$ !	P2-8 = (OPTIONAL) A DCL command to be executed
$ !
$ if p1 .eqs. "" then read/prompt="Node: " sys$command p1
$ nodespec = p1 - "::"
$ nodename = f$extract(0,f$locate("""",nodespec),nodespec)
$ on warning then continue
$ close/err=10$ tell_server
$ 10$:
$ open/read/write tell_server 'nodespec'::"TASK=TELL"/error=open_failure
$ on warning then goto exit
$
$flush_output:
$ read tell_server record
$ if record .eqs. "ABOUT_TO_ISSUE_READ" then goto send_command
$ write sys$output record
$ goto flush_output
$
$send_command:
$ if p2 .nes. "" then goto single_command
$ read sys$command record /promt="TELL ''nodename'> " /end=exit
$ record	:= 'record
$ if record .eqs. "EXIT" then goto exit
$ write tell_server record
$ goto flush_output
$
$single_command:
$ command := 'p2' 'p3' 'p4' 'p5' 'p6' 'p7' 'p8'
$ write tell_server command
$single_flush:
$ read tell_server record
$ if record .eqs. "ABOUT_TO_ISSUE_READ" then goto exit
$ write sys$output record
$ goto single_flush
$
$open_failure:
$ on warning then exit
$ copy/log 0::tell.com 'nodespec'::
$ wait 0:0:1	! Wait for remote FAL process to get ready
$ open/read/write tell_server 'nodespec'::"TASK=TELL"
$ on warning then goto exit
$ goto flush_output
$
$exit:
$ close tell_server
$ exit
$
$network:
$ open/read/write tell_link sys$net
$ set noon
$ tell_verify = 'f$verify(0)'
$ define sys$output tell_link:
$server_loop:
$ write tell_link "ABOUT_TO_ISSUE_READ"
$ read tell_link tell_string /end_of_file=server_exit /error=server_exit
$ 'tell_string'
$ goto server_loop
$server_exit:
$ if tell_verify then set verify
$ close tell_link
$ deassign sys$output