BGUPRE ; IHS/OIT/MJL - PRE INSTALL TO STOP LISTENER ;
;;1.5;BGU;;MAY 26, 2005
;;TCP Utility to Stop Listener
;;BGUTSKT is the Socket port number for listening
;;
STOP ;EP-- entry point for stoping Listener before insatll of kids
S BGUTSKT=$G(^BGUSP(1,2),8000) ;default port
D END(BGUTSKT)
Q
END(BGUTSKT) ;stop TCP Listener. Interactive and TaskMan entry point
;N IP,REF,X,DEV,XWBOS,XWBIP
S U="^" D HOME^%ZIS
D EN^DDIOL("Stop TCP Listener...")
X ^%ZOSF("UCI") S REF=Y
S IP="0.0.0.0" ;get server IP
S XWBOS=$S(^%ZOSF("OS")["DSM":"DSM",^("OS")["MSM":"MSM",^("OS")["OpenM":"OpenM",1:"") ;RWF
;
I $G(BGUTSKT)="" S BGUTSKT=8000 ;default port
; -- make sure the listener is running
L +^BGUSP("TMP","RUNNING"):1
I $T D Q
. L -^BGUSP("TMP","RUNNING"):1
. D EN^DDIOL("TCP Listener does not appear to be running.")
;
; -- set the stop flag
S ^BGUSP("TMP","STOP")=1
;
; -- send the shutdown message to the TCP Listener process
; using loopback address
S XWBTSKT=BGUTSKT
S XWBIP="127.0.0.1"
D CALL^%ZISTCP("127.0.0.1",XWBTSKT) I POP D Q
. D EN^DDIOL("TCP Listener does not appear to be running.")
U IO
;
W $C(11),"TCPshutdown",! ; -- send the shutdown message
R X#3:5
D EN^DDIOL("TCP Listener Response to Shutdown Request: "_X)
D CLOSE^%ZISTCP
IF X="ack" D EN^DDIOL("TCP Listener has been shutdown.")
ELSE D EN^DDIOL("Shutdown Failed!")
;change process name
;D CHPRN^XWBTCPC($J)
Q
BGUPRE ; IHS/OIT/MJL - PRE INSTALL TO STOP LISTENER ;
+1 ;;1.5;BGU;;MAY 26, 2005
+2 ;;TCP Utility to Stop Listener
+3 ;;BGUTSKT is the Socket port number for listening
+4 ;;
STOP ;EP-- entry point for stoping Listener before insatll of kids
+1 ;default port
SET BGUTSKT=$GET(^BGUSP(1,2),8000)
+2 DO END(BGUTSKT)
+3 QUIT
END(BGUTSKT) ;stop TCP Listener. Interactive and TaskMan entry point
+1 ;N IP,REF,X,DEV,XWBOS,XWBIP
+2 SET U="^"
DO HOME^%ZIS
+3 DO EN^DDIOL("Stop TCP Listener...")
+4 XECUTE ^%ZOSF("UCI")
SET REF=Y
+5 ;get server IP
SET IP="0.0.0.0"
+6 ;RWF
SET XWBOS=$SELECT(^%ZOSF("OS")["DSM":"DSM",^("OS")["MSM":"MSM",^("OS")["OpenM":"OpenM",1:"")
+7 ;
+8 ;default port
IF $GET(BGUTSKT)=""
SET BGUTSKT=8000
+9 ; -- make sure the listener is running
+10 LOCK +^BGUSP("TMP","RUNNING"):1
+11 IF $TEST
Begin DoDot:1
+12 LOCK -^BGUSP("TMP","RUNNING"):1
+13 DO EN^DDIOL("TCP Listener does not appear to be running.")
End DoDot:1
QUIT
+14 ;
+15 ; -- set the stop flag
+16 SET ^BGUSP("TMP","STOP")=1
+17 ;
+18 ; -- send the shutdown message to the TCP Listener process
+19 ; using loopback address
+20 SET XWBTSKT=BGUTSKT
+21 SET XWBIP="127.0.0.1"
+22 DO CALL^%ZISTCP("127.0.0.1",XWBTSKT)
IF POP
Begin DoDot:1
+23 DO EN^DDIOL("TCP Listener does not appear to be running.")
End DoDot:1
QUIT
+24 USE IO
+25 ;
+26 ; -- send the shutdown message
WRITE $CHAR(11),"TCPshutdown",!
+27 READ X#3:5
+28 DO EN^DDIOL("TCP Listener Response to Shutdown Request: "_X)
+29 DO CLOSE^%ZISTCP
+30 IF X="ack"
DO EN^DDIOL("TCP Listener has been shutdown.")
+31 IF '$TEST
DO EN^DDIOL("Shutdown Failed!")
+32 ;change process name
+33 ;D CHPRN^XWBTCPC($J)
+34 QUIT