Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BGUPRE

BGUPRE.m

Go to the documentation of this file.
  1. BGUPRE ; IHS/OIT/MJL - PRE INSTALL TO STOP LISTENER ;
  1. ;;1.5;BGU;;MAY 26, 2005
  1. ;;TCP Utility to Stop Listener
  1. ;;BGUTSKT is the Socket port number for listening
  1. ;;
  1. STOP ;EP-- entry point for stoping Listener before insatll of kids
  1. S BGUTSKT=$G(^BGUSP(1,2),8000) ;default port
  1. D END(BGUTSKT)
  1. Q
  1. END(BGUTSKT) ;stop TCP Listener. Interactive and TaskMan entry point
  1. ;N IP,REF,X,DEV,XWBOS,XWBIP
  1. S U="^" D HOME^%ZIS
  1. D EN^DDIOL("Stop TCP Listener...")
  1. X ^%ZOSF("UCI") S REF=Y
  1. S IP="0.0.0.0" ;get server IP
  1. S XWBOS=$S(^%ZOSF("OS")["DSM":"DSM",^("OS")["MSM":"MSM",^("OS")["OpenM":"OpenM",1:"") ;RWF
  1. ;
  1. I $G(BGUTSKT)="" S BGUTSKT=8000 ;default port
  1. ; -- make sure the listener is running
  1. L +^BGUSP("TMP","RUNNING"):1
  1. I $T D Q
  1. . L -^BGUSP("TMP","RUNNING"):1
  1. . D EN^DDIOL("TCP Listener does not appear to be running.")
  1. ;
  1. ; -- set the stop flag
  1. S ^BGUSP("TMP","STOP")=1
  1. ;
  1. ; -- send the shutdown message to the TCP Listener process
  1. ; using loopback address
  1. S XWBTSKT=BGUTSKT
  1. S XWBIP="127.0.0.1"
  1. D CALL^%ZISTCP("127.0.0.1",XWBTSKT) I POP D Q
  1. . D EN^DDIOL("TCP Listener does not appear to be running.")
  1. U IO
  1. ;
  1. W $C(11),"TCPshutdown",! ; -- send the shutdown message
  1. R X#3:5
  1. D EN^DDIOL("TCP Listener Response to Shutdown Request: "_X)
  1. D CLOSE^%ZISTCP
  1. IF X="ack" D EN^DDIOL("TCP Listener has been shutdown.")
  1. ELSE D EN^DDIOL("Shutdown Failed!")
  1. ;change process name
  1. ;D CHPRN^XWBTCPC($J)
  1. Q