| This will remotely run a file through decw$ if you have proxe on the remote
system and allow security access to your session manager.
Load it and run @thisfile help
*********** cut *******
$ goto top
$!
$ ! remsub.com
$ ! created to get around using DECnet 0 tasks for
$ ! corporate security reasons!
$ ! executed on your workstation
$ !Features:
$ ! 1. Uses submit/remote to keep the net police happy.
$ ! 2. Run's /detatched to free up the batch queue slot.
$ ! 3. Takes node-name, command
$ ! 4. Runs from the workstation.
$ ! modified 1/12/89 to optionally accept process_name and general cleanup
$ ! == ken miller ==
$ ! modified 3/89 to allow more defaults and cmd line input and help
$ !
$TOP:
$! set these to what ever defaults you want?
$ def_node = "LAS057" ! node if not specifid
$ def_cmd = "VERB" ! function if not specifid
$ def_prog = "DECW$MAIL" ! application if not specifid
$ cmd :=
$ cmd1 :=
$ node :=
$ prog :=
$!
$ file_num = 0
$ func = "func"
$ tell = "write sys$output"
$ file = "write temp"
$ run_opts = "MCR/MC/M//RUN/R/@/VERB/V/" ! this is whats allowed now
$ no_cmd = "VERB/" ! no command opts
$ sel_opts = "NODE/PROGRAM/PROG/" ! this is whats allowed now
$ ext_opts = "EXT/EXTEND/CMD1/" ! extended command
$ parm :=
$ parm1 :=
$ x=0
$!
$NOINPUT:
$ if p1 .NES. "" then goto start
$ inquire p1 "Command? [""''def_cmd'""] "
$ if p1 .eqs. "" then p1 = def_cmd
$ inquire p2 "Application? [""''def_prog'""] "
$ if p2 .eqs. "" then p2 = def_prog
$ inquire p3 "Remote Node? [''def_node'] "
$ if p3 .eqs. "" then p3 = def_node
$ Goto start
$!
$HELP:
$ 'tell "Remotely run an object and display it here "
$ 'tell " Run options are as follows: "
$ 'tell " Option1 - to select node type: NODE name "
$ 'tell " to select the command type: MCR, VERB, RUN or @ "
$ 'tell " to select the program type: PROG filespec "
$ 'tell " to select Optional command "
$ 'tell " for the remote system it "
$ 'tell " should be the last elements "
$ 'tell " type: EXT spec "
$ 'tell " i.e. $ RUN NODE foo PROG CMS/DECW EXT SET DEF [.DEV]"
$ 'tell " "
$ 'tell " Option2 - (@, RUN, VERB or MCR) NODE::FILESPEC EXTENDED_CMDS"
$ 'tell " "
$ 'tell " Option3 - (@, RUN, VERB or MCR) NODE FILESPEC EXTENDED_CMDS"
$ 'tell " "
$ 'tell " Note :To run a program with parameters put the command and "
$ 'tell " and the parameters in quots"
$ EXIT
$START:
$DO_PARM:
$ x=x+1
$ p'x' = f$edit(p'x', "UPCASE")
$ parm = p'x'
$ if parm .eqs. "HELP" then goto help
$ if parm .EQS. "" then goto run
$ IF (F$LOCATE(parm+"/",RUN_OPTS) .NE. F$LENGTH(RUN_OPTS)) .OR -
(F$LOCATE(parm+"/",NO_CMD) .NE. F$LENGTH(NO_CMD)) THEN goto cmd
$ IF F$LOCATE(parm+"/",SEL_OPTS) .NE. F$LENGTH(SEL_OPTS) THEN goto 'parm
$ IF F$LOCATE(parm+"/",EXT_OPTS) .NE. F$LENGTH(EXT_OPTS) THEN goto ext
$ gosub options
$ goto do_parm
$!
$NODE: ! get the node name
$ x=x+1
$ parm = p'x'
$NODE1:
$ node = f$extract(0,f$locate(":","''parm'"),"''parm'")
$ goto do_parm
$!
$CMD: ! get the node name
$ parm = p'x'
$ cmd = parm
$ if cmd .EQS. "V" then cmd := VERB
$ if cmd .EQS. "R" then cmd := RUN
$ if (cmd .EQS. "M") .OR. (cmd .EQS. "MC") then cmd := MCR
$ goto do_parm
$!
$EXT: ! get the node name
$ x=x+1
$ parm = p'x'
$ if parm .EQS. "" then goto do_parm
$ cmd1 = cmd1 + parm + " "
$ goto ext
$!
$!
$PROGRAM: ! get the program name
$PROG:
$ x=x+1
$ parm = p'x'
$PROG1:
$ prog = parm
$ if f$extract(0,1,prog) .NES. "@" then goto prog2
$ cmd = "@"
$ prog = f$extract(1,f$length(prog),prog)
$PROG2:
$ if f$locate("::","''prog'") .EQ. f$length("''prog'") then goto prog3
$ parm = prog
$ node = f$extract(0,f$locate(":","''parm'"),"''parm'")
$ prog = f$extract(f$locate("::","''prog'")+2,f$length("''prog'"),"''prog'")
$PROG3:
$ goto do_parm
$!
$OPTIONS:
$ if prog .EQS. "" then goto PROG1
$ if node .EQS. "" then goto node1
$ return
$
$!
$RUN:
$! set defaults
$ if prog .EQS. "" then prog = def_prog
$ if node .EQS. "" then node = def_node
$ if cmd .EQS. "" then cmd = def_cmd
$ IF F$LOCATE(cmd+"/",NO_CMD) .NE. F$LENGTH(no_cmd) .OR. -
f$locate("/","''prog'") .NE. f$length("''prog'") then cmd :=
$!
$ WS_node = f$extract(0,f$locate(":",f$trnlnm("SYS$NODE")),f$trnlnm("SYS$NODE"))
$ if WS_node .eqs. node
$ then local_flag = "true"
$ else local_flag = "false"
$ endif
$!
$! strip down the function and give us a name
$ func = f$edit(prog, "UPCASE,COMPRESS,TRIM")
$ func = f$extract(0,f$locate("/","''func'"),"''func'")
$ if f$locate(":","''func'") .NE. f$length("''func'") then -
func = f$extract(f$locate(":","''func'")+1,f$length("''func'"),"''func'")
$ if f$locate("]","''func'") .NE. f$length("''func'") then -
func = f$extract(f$locate("]","''func'")+1,f$length("''func'"),"''func'")
$ if f$locate("$","''func'") .NE. f$length("''func'") then -
func = f$extract(f$locate("$","''func'")+1,f$length("''func'"),"''func'")
$ if f$locate(" ","''func'") .NE. f$length("''func'") then -
func = f$extract(0,f$locate(" ","''func'"),"''func'")
$ func = f$extract(0,f$locate("_","''func'"),"''func'")
$!
$!
$!
$! This is the command file that will run the requested program
$!
$!
$!
$ on warning then EXIT
$ dir/out=nla0: 'node::
$NAME:
$!
$ gosub rename
$ on warning then goto got_name
$ dir/out=nla0: 'node::'WS_node'_'func'1.com
$CNG_NAME:
$ goto NAME
$GOT_NAME:
$!
$ 'tell "Creating a command file on ''node' with"
$ if cmd1 .NES. "" then 'tell " ""$ ''cmd1'"" "
$ 'tell " ""$''cmd' ''prog'"" displayed on ''WS_node' "
$!
$ if local_flag .nes. "true"
$ then open/write temp 'node::'WS_node'_'func'1.com
$ else open/write temp sys$login:'WS_node'_'func'1.com
$ endif
$ 'file "$ set verify"
$ if local_flag .nes. "true"
$ then 'file "$ set display/create/node=''WS_node'"
$ else 'file "$ set display/create/transport=local"
$ endif
$ 'file "$ ''cmd1'"
$ 'file "$ ''cmd' ''prog'"
$ 'file "$ set display/noperm "
$ 'file "$ purge ''WS_node'_''func'*.log"
$ 'file "$ del ''WS_node'_''func'*.com;*"
$ close temp
$!
$!
$! This is the batch file that will create the process and run the command
$!
$!
$ 'tell "Creating Batch File "
$ if local_flag .nes. "true"
$ then open/write temp 'node::'WS_node'_'func'2.com
$ else open/write temp sys$login:'WS_node'_'func'2.com
$ endif
$ 'file "$ define sys$print nl:"
$ 'file "$ set verify"
$ 'file "$ proc_num = 0"
$ 'file "$ user = F$EDIT(f$getjpi(0,""USERNAME""),""COLLAPSE"") "
$ 'file "$ proc_name = ""''WS_node'$"" + ""''func'"""
$ 'file "$ proc_name = f$edit(proc_name, ""COLLAPSE"")
$ 'file "$ if (f$length(proc_name) .GT. 12 ) then - "
$ 'file " proc_name = f$extract(0,12,proc_name) "
$ 'file "$CHECK: "
$ 'file "$ on warning then goto cont"
$ 'file "$ sho proc/nooutput 'proc_name "
$ 'file "$ gosub rename "
$ 'file "$ goto check "
$ 'file "$CONT:"
$ 'file "$ on warning then proc_name = user "
$ 'file "$ sho proc/nooutput 'user "
$ 'file "$ run/detached sys$system:loginout.exe -"
$ 'file " /input=''WS_node'_''func'1.com -"
$ 'file " /error=''WS_node'_''func'1.log -"
$ 'file " /output=''WS_node'_''func'1.log -"
$ 'file " /proc='proc_name - "
$ 'file " /buffer_limit=30000/enqueue_limit=800/extent=10000 -"
$ 'file " /io_buffered=100/io_direct=100/maximum_working_set=2048 -"
$ 'file " /page_file=30000/authorize/file_limit=64/working_set=512"
$ 'file "$ exit"
$ 'file "$rename:
$ 'file "$ proc_num = proc_num + 1
$ 'file "$ proc_name = f$extract(0,f$locate(""_"",proc_name),proc_name) + ""_"" + f$string(proc_n
$ 'file "$ return
$ close temp
$!
$ 'tell "Submitting Batch Command File..."
$ if local_flag .nes. "true"
$ then submit/remote/nonotify/noprint 'node::'WS_node'_'func'2.com
$ else submit/notify/noprint sys$login:'WS_node'_'func'2.com
$ endif
$ EXIT
$!
$rename:
$! if f$locate("_",func) .EQ.f$length(func) then
$ file_num = file_num + 1
$ func = f$extract(0,f$locate("_",func),func) + "_" + f$string(file_num)
$ return
0
|