From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 27-JUL-1990 16:21:59.87
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	SHOW/REMOTE part 1

Received:  by crdgw1.ge.com (5.57/GE 1.70)
	 id AA09646; Fri, 27 Jul 90 14:29:53 EDT
Received: From UCBVAX.BERKELEY.EDU by CRVAX.SRI.COM with TCP; Fri, 27 JUL 90 09:41:19 PDT
Received: by ucbvax.Berkeley.EDU (5.63/1.42)
	id AA07203; Fri, 27 Jul 90 09:22:58 -0700
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 27 Jul 90 16:06:58 GMT
From: umich!vela!tarcea@CS.YALE.EDU  (The OUTLAWS)
Organization: Oakland University, Rochester MI
Subject: SHOW/REMOTE part 1
Message-Id: <2254@vela.acs.oakland.edu>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com


   Here is the code to let you do a SHOW/REMOTE. Because of the size of it
it is broken into 4 parts. As usual no warranties or anything, but if you come
up with a better way or whatever I would appreciate mail on the subject. For
those of you who missed it here is what this doesn :

   allows you to do a show any_show_command on a remote node (ie it doesn't
have to be a part of your cluster). For example you can do the following :

  SHOW/REMOTE=PICTOR USERS  to see the users on node PICTOR

      or

  SHOW/REMOTE=PICTOR MEMORY/FULL/POOL/ALL  to see the memory usage on pictor

      or

  SHOW/REMOTE=PICTOR SYSTEM  to see whats up with the system on pictor.

  This change to the SHOW command is transparent to the user. The only thing
you will notice is no help, maybe that can be rememdied later. Anyways the
code needs no privs or anything, and is really kind of nice. Enjoy !!!!

$! ------------------ CUT HERE -----------------------
$ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 7.1-004  3-AUG-1989
$!   On 27-JUL-1990 11:44:25.88   By user TARCEA 
$!
$! This VMS_SHARE Written by:
$!    Andy Harper, Kings College London UK
$!
$! Acknowledgements to:
$!    James Gray       - Original VMS_SHARE
$!    Michael Bednarek - Original Concept and implementation
$!
$!+ THIS PACKAGE DISTRIBUTED IN 4 PARTS, TO KEEP EACH PART
$!  BELOW 30 BLOCKS
$!
$! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
$! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$!       1. BUILD.COM;1
$!       2. CLD_INSTALL.COM;1
$!       3. CLI$.INC;1
$!       4. CLI$.PAS;1
$!       5. READ.ME;1
$!       6. SHOW.CLD;1
$!       7. SHOWR.PAS;1
$!       8. SHOWREM.COM;1
$!       9. SHOWREMSERVER.PAS;1
$!      10. SHOWREMSETUP.COM;1
$!      11. SYSTEM.INC;1
$!      12. SYSTEM.V4_INC;1
$!      13. UTIL.INC;1
$!      14. UTIL.PAS;1
$!
$set="set"
$set symbol/scope=(nolocal,noglobal)
$f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
$e="write sys$error  ""%UNPACK"", "
$w="write sys$output ""%UNPACK"", "
$ if f$trnlnm("SHARE_LOG") then $ w = "!"
$ if f$getsyi("version") .ges. "V4.4" then $ goto START
$ e "-E-OLDVER, Must run at least VMS 4.4"
$ v=f$verify(v)
$ exit 44
$UNPACK: SUBROUTINE ! P1=filename, P2=checksum
$ if f$search(P1) .eqs. "" then $ goto file_absent
$ e "-W-EXISTS, File ''P1' exists. Skipped."
$ delete/nolog 'f'*
$ exit
$file_absent:
$ if f$parse(P1) .nes. "" then $ goto dirok
$ dn=f$parse(P1,,,"DIRECTORY")
$ w "-I-CREDIR, Creating directory ''dn'."
$ create/dir 'dn'
$ if $status then $ goto dirok
$ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
$ delete/nolog 'f'*
$ exit
$dirok:
$ w "-I-PROCESS, Processing file ''P1'."
$ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");
buff:=CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(buff))
;LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
BEGINNING_OF(buff));g:=0;LOOP EXITIF MARK(NONE)=END_OF(buff);x:=
ERASE_CHARACTER(1);IF g = 0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x=
"V" THEN APPEND_LINE;MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;
IF x="+" THEN g:=1;ERASE_LINE;ENDIF;ELSE IF x="-" THEN g:=0;ENDIF;ERASE_LINE;
ENDIF;ENDLOOP;p:="`";POSITION(BEGINNING_OF(buff));LOOP r:=SEARCH(p,FORWARD);
EXITIF r=0;POSITION(r);ERASE(r);COPY_TEXT(ASCII(INT(ERASE_CHARACTER(3))));
ENDLOOP;o:=GET_INFO(COMMAND_LINE,"output_file");WRITE_FILE(buff,o);
ENDPROCEDURE;Unpacker;EXIT;
$ delete/nolog 'f'*
$ CHECKSUM 'P1'
$ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
$ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ ENDSUBROUTINE
$START:
$ create/nolog 'f'
X$ pascal showremserver
X$ link showremserver/notrace
X$ pas util
X$ pas cli$
X$ pas showr
X$ link showr,util,cli$
$ CALL UNPACK BUILD.COM;1 1802921668
$ create/nolog 'f'
X$ Install := $Install/command
X$ Set Command 'P1' /Replace
X$ Set Command 'P1' /Replace /Tables=SYS$COMMON:`091SYSLIB`093DCLTABLES /Outp
Vut=SYS$COMMON:`091SYSLIB`093DCLTABLES
X$ Set Prot=(S:rwed,O:rwed,G:rwe,W:re) SYS$COMMON:`091SYSLIB`093DCLTABLES.EXE
X$ Set File /Own=`091SYSTEM`093 SYS$COMMON:`091SYSLIB`093DCLTABLES.EXE
X$ Install Replace SYS$COMMON:`091SYSLIB`093DCLTABLES.EXE /Open /Header_Res /
VShared
$ CALL UNPACK CLD_INSTALL.COM;1 505638866
$ create/nolog 'f'
X
Xfunction CliGetValue_String(name: string): string ;
Xextern ;
X
Xfunction CliGetValue_Integer(name: string): integer ;
Xextern ;
X
Xfunction CliGetValue_Unsigned(name : string): unsigned ;
Xextern ;
X
Xfunction CliPresent(value: string): boolean ;
Xextern ;
X
Xfunction CliGetValue_DateTime(value: string): quadword ;
Xextern ;
X
Xprocedure CliGetValue_BooleanM3(var b1: boolean ;
X                                var b2: boolean ;
X                                var b3: boolean ;
X                                v1: string ;
X                                v2: string ;
X                                v3: string ;
X                                name: string) ;
Xextern ;
$ CALL UNPACK CLI$.INC;1 503527626
$ create/nolog 'f'
X`091inherit('sys$library:starlet')`093
Xmodule cli(input,output) ;
X
X%INCLUDE 'SYSTEM.V4_INC'
X%INCLUDE 'util.inc'
X
X`091global`093
Xfunction CliGetValue_String(name: string): string ;
X   var
X     status: unsigned ;
X     value: string ;
X    begin
X      status:= cli$get_value(name,value) ;
X      if status = CLI$_ABSENT then CliGetValue_String:= ' '`032
X      else CliGetValue_string:= value ;
X    end ;
X
X`091global`093
Xprocedure CliGetValue_BooleanM3(var b1: boolean ;
X                                var b2: boolean ;
X                                var b3: boolean ;
X                                v1: string ;
X                                v2: string ;
X                                v3: string ;
X                                name: string) ;
X   var
X     status: unsigned ;  `123* return value check for cli$get_value call *`1
V25
X     value: string ; `123* value returned *`125
X   begin
X     b1:= false ; b2:= false ; b3:= false ;
X     status := cli$get_value(name,value) ;
X     if status = CLI$_COMMA then begin
X       if v1 = value then b1:= true`032
X       else if v2 = value then b2:= true`032
X       else b3:= true ;
X       while cli$get_value(name,value) = CLI$_COMMA do begin
X         if v1 = value then b1:= true`032
X         else if v2 = value then b2:= true`032
X         else b3:= true ;
X       end ;
X      end`032
X     else begin
X       if v1 = value then b1:= true`032
X       else if v2 = value then b2:= true`032
X       else b3:= true ;
X     end ;
X   end ;
X
X`091global`093
Xfunction CliGetValue_DateTime(name: string): quadword ;
X  var
X    status: unsigned ;
X    value: string ;
X  begin
X    status:= cli$get_value(name,value) ;
X    CliGetValue_DateTime:= binary_time(value) ;
X  end ;
X
X`091global`093
Xfunction CliGetValue_Integer(name: string): integer ;
X  var
X   status: unsigned ;
X   value: string ;
X   ivalue: integer ;
X  begin
X    status:= cli$get_value(name,value) ;
X    if status = CLI$_ABSENT then CliGetValue_Integer:= 0
X    else begin
X     ivalue:= to_integer(value) ;
X     CliGetValue_Integer:= ivalue ;
X    end ;
X  end ;
X
X`091global`093
Xfunction CliPresent(value: string): boolean ;
X  var
X   status: unsigned ;
X  begin
X    status:= cli$present(value) ;
X    if (status = CLI$_PRESENT) then CliPresent:= true
X    else CliPresent:= false ;
X  end ;
X
X`091global`093
Xfunction CliGetValue_Unsigned(name: string): unsigned ;
X  var
X   status: unsigned ;
X   value: string ;
X   uvalue: unsigned ;
X
X  begin
X    status:= cli$get_value(name,value) ;
X    if status = CLI$_ABSENT then CliGetValue_Unsigned:= 0
X    else begin
X     uvalue:= uint(to_integer(value)) ;
X     CliGetValue_Unsigned:= uvalue ;
X    end ;
X  end ;
X
Xend.
$ CALL UNPACK CLI$.PAS;1 788858313
$ create/nolog 'f'
X            ===========  SHOW/REMOTE =========
X
X   SHOW/REMOTE is a little program I wrote because I thought it was kind of
Xridiculous that I could not do distributed computing commands from VMS. For
Xexample we can do a SHOW USER/NODE=node-name if the system we are on is part
Xof a cluster, but what if I am not part of a cluster!! And more important ev
Ven
Xif I am part of a cluster perhaps there are other commands I wish to execute
V to
Xsee what is going on on another node (like SHOW MEMORY).
X  To fix this, what I consider serious, deficieny I modified the SHOW cld an
Vd
Xcreated an object I call SHOW$SERVER. What I have basically done is built in
Vto
XSHOW the ability to 'SHOW' things on other nodes that we have access to. And
Xmost important, our system doesn't have to be in a cluster with these other
Xsystems! After looking at the code you will see that it is pretty trivial,
Xthere is hardly anything to it. Anyways enjoy, and if you come up with any
Xsuggestions, or a better way of doing things please send me mail. I wrote th
Vis
Xto see if I could get it to work, and after I got it working I didn't go bac
Vk
Xto see if perhaps there are better ways to do things.
X
X   SYNTAX:
X
X      $ SHOW/REMOTE=node-name REST_OF_SHOW_COMMAND
X
X    Examples:
X
X       $ SHOW/REMOTE=ARGO USERS
X       $ SHOW/REMOTE=CYGNUS SYSTEM
X       $ SHOW/REMOTE=PICTOR MEMORY/POOL/FULL
X       $ SHOW/REMOTE=PICTOR QUEUE SYS$BATCH/FULL/ALL/CHAR
X
X   SETUP:
X    `032
X      To use SHOW/REMOTE you must install it on the system, and install the
X      object on each of the systems on which you wish to be able to do a
X      SHOW/REMOTE on. I have provided a couple of files to make the job of
X      installation easier. The First file is SHOWREMSETUP.COM, before using
X      this file you must create an account called SHOW$SERVER. You can give
X      this account no quota (on my system it has 2 blocks of quota and 100
X      overdraft). The COM file SHOWREMSETUP will do the rest, it will set up
X      the account so that it is restricted etc.... It will also create the N
VCP
X      object SHOWREM. Currently I give the object number 128, if you wish to
X      give it something different then you will have to modify both the sour
Vce
X      to SHOWR.PAS and the SHOWREMSETUP com file. Also SHOWREMSETUP assumes`
V032
X      that SHOWREMSERVER.EXE is in your current directory when it goes to co
Vpy
X      it over into SYS$COMMON:`091SYSMGR`093.
X        The other COM files I include are the object (SHOWREM.COM), and file
Vs
X      for compiling and linking the code. You will notice that I have includ
Ved`032
X      a couple of extraneous files (CLI.PAS and CLI.INC, UTIL.PAS and UTIL.I
VNC,
X      and SYSTEM.INC). All the defintions and code in these files I could ha
Vve
X      just included in SHOWR and SHOWREMSERVER, but I use them all the time
V in
X      code development, and thought they may come in useful for others on th
Ve
X      net, feel free to do with them what you will. Only please no flames :-
V).
X      Also the code I am supplying is ASIS, no warranty's or anything, but i
Vf`032
X      you do have problems, or suggestions please send me mail. I have had
X      absolutely no problem with the code as written, but if I have unwittin
Vgly
X      opened some security hole or something that gives (other than the abil
Vity
X      to see what is going on on a remote system) I would like to know.`032
X
X
X   SHOWREMSERVER:
X       This is the program that actually does the command on the remote node
X       and sends its output back to the local node. It is called by the obje
Vct
X       SHOWREM.COM. There isn't much too this program, I basically just open
X       SYS$NET read the command append 'SHOW ' to the command, spawn of a`03
V2
X       process, set up an exit handler, read the output from the spawned
X       process and write it on back down SYS$NET.
X
X   SHOWR:                                       `032
X       This code is also is very trivial. I just parse the command line, pic
Vk
X       out the command and the node to send the command to, open a connectio
Vn
X       to the remote nodes object 128 and send it the command. I then read f
Vrom
X       SYS$NET until there is no more output.
X
X
X   SHOW.CLD
X       I added 4 count them 4 lines to the original SHOW cld to get it to
X       function as you see. They are documented within the SHOW.CLD, but I w
Vill
X       go over them here also. (Note thought, that when you upgrade the syst
Vem
X       you should probably go in and modify that systems CLD. There are two
X       ways you can do this, you can extract the original CLD's from the
X       upgrade tape, or you can use that wonderful command VERB. I believe y
Vou
X       can pick up VERB from uars.acd.ucar.edu, or gatekeep.dec.com). Here
X       are the changes:
X
X       I added:
X
X       define syntax show_remote
X         image showr
X         parameter p1, label=option, value(type=$rest_of_line)
X
X     and I added changed the original definition of the verb show`032
X  FROM:
X
X      define verb show
X        parameter p1, label=option, value(type=show_options)
X
X   TO:
X
X   define verb show
X     qualifier remote, syntax=show_remote, value(required),placement=positio
Vnal
X     parameter p1, label=option, value(type=show_options)
X
X   4 whole lines have been added!!!!
X
X
X  CLD_INSTALL.COM:
X
X      this com file is for adding the modified SHOW.CLD to DCLTABLES.EXE, if
X      you want to test things for a while, then just put a :
X        $ SET COMMAND SHOW
X      in your login.com to force your process to use the "new" SHOW definiti
Von,
X      and after you have confidence in it, then go ahead and install it.
X
X
X    -- glenn
X
X   tarcea@vela.acs.oakland.edu
X
X
X
X
X
$ CALL UNPACK READ.ME;1 206102935
$ create/nolog 'f'
Xdefine type acl_objects
X`009keyword file
X`009keyword device
X`009keyword queue
X`009keyword event_cluster
X`009keyword logical_name_table
X`009keyword process
X`009keyword system_global_section
X`009keyword group_global_section
X
X
Xdefine type acmode
X`009keyword user_mode
X`009keyword supervisor_mode
X`009keyword executive_mode
X`009keyword kernel_mode
X
Xdefine type job_status
X`009keyword pending
X`009keyword executing
X`009keyword holding
X`009keyword timed_release
X`009keyword retained
X
Xdefine type devices
X`009keyword printer
X`009keyword server
X`009keyword terminal
X
Xdefine syntax show_acl
X`009image setshoacl
X`009parameter p1,label=option,value(required)
X`009parameter p2,label=input,prompt="Object name",value(required)
X`009qualifier object_type,`009value(required,type=acl_objects)
X
X!
X! added the following syntax defintion
X! note how I changed p1 from value(required)
X! to value(type=$rest_of_line)
X!
X
Xdefine syntax show_remote
X       image showr
X       parameter p1,label=option, value(type=$rest_of_line)
X
Xdefine syntax show_audit
X    `009parameter p1,label=option,value(required)
X    `009qualifier output,`009default,value(type=$file,default="SYS$OUTPUT")
X`009qualifier failure_mode,`009nonnegatable
X`009qualifier journal,`009nonnegatable,value
X`009qualifier user,`009`009nonnegatable,value
X`009qualifier all,`009`009nonnegatable
+-+-+-+-+-+-+-+-  END  OF PART 1 +-+-+-+-+-+-+-+-


   

