home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / pidsrv.zip / pidclnt.cmd < prev    next >
OS/2 REXX Batch file  |  1996-06-14  |  2KB  |  101 lines

  1. /*PID Client v1.00 of PID Server*/
  2. /*This program is used to kill a process on a remote machine that may be*/
  3. /*blocking the que.*/
  4.  
  5. RxExtraAPI = RxFuncQuery('RxExtra')  /* Checks for Rxextras */
  6. IF RxExtraAPI \= 0 THEN
  7.        DO
  8.                Call RxFuncAdd 'RxExtra', 'RxExtras' , 'RxExtra'
  9.                Call RxExtra 'Load'
  10.        END
  11.  
  12. If RxFuncQuery('SysLoadFuncs') THEN
  13.     DO
  14.        IF RxFuncAdd('SysLoadFuncs','RexxUtil','SysLoadFuncs') THEN
  15.          DO
  16.          Say 'Error:Could not load RexxUtil library.'
  17.          End
  18.     Call SysLoadFuncs
  19.     END
  20. Test = RxFuncQuery('GrxLoadFuncs')
  21. IF Test >< 0 THEN
  22.        Do
  23.        Call RxFuncAdd 'GrxLoadFuncs', 'GRXUTILS', 'GRXLOADFUNCS'
  24.        Call GrxLoadFuncs
  25.        End
  26.  
  27. /************************* End loading DLLs ****************/
  28. SIGNAL ON HALT
  29.  
  30. Call SysCls
  31. Say 'PID Client v1.00'
  32.  
  33. BEEP(250,250)
  34. Say 'WARNING: This program is used to kill a process running on a remote machine.'
  35. Say '         PLEASE use with caution!'
  36. Say
  37. Say
  38. Say 'Enter the network name of the computer running PID Server to connect with:'
  39.  
  40. Pull Server
  41.  
  42. pipename = '\\' || Server || '\PIPE\SFOGG\PIDSERVER'
  43. bufsize = 256
  44.  
  45. hpipe = GrxClientOpenNPipe(pipename, bufsize)
  46.  
  47. if hpipe = 0 then
  48.        do
  49.           Say 'Could not open named pipe to' Server
  50.           exit
  51.        end
  52.  
  53. Say
  54. Say 'Sending a request for a process list'
  55. Say '     NOTE: Depending upon condition of' server 'this could take some time'
  56.  
  57. Call PIPESEND 'L'
  58.  
  59. /***********************   Main loop ***************************/
  60.  
  61. DO FOREVER
  62.  
  63. Pull msg
  64. IF msg = '' THEN
  65.        CALL HALT
  66.  
  67. Call PIPESEND msg
  68.  
  69. End
  70.  
  71. EXIT
  72.  
  73. /***************************PIPESEND*************************/
  74. PIPESEND:
  75.  
  76. ARG msg
  77. Say
  78. writerc = GrxWriteNPipe(hpipe, msg)
  79.        IF writerc >< 0 then
  80.                DO
  81.                   say 'Could not write to pipe.'
  82.                   Call GrxClientCloseNPipe
  83.                   exit
  84.                END
  85.        Else
  86.        Do until readmsg = '0000'
  87.                readrc = GrxReadNPipe(hpipe, 'readmsg')
  88.                IF readmsg >< '0000' THEN
  89.                     Say readmsg
  90.  
  91.        End
  92.  
  93. RETURN
  94.  
  95. /**************************HALT***********************/
  96. HALT:
  97. Say 'Exiting.......'
  98. rc = GrxClientCloseNPipe(hpipe)
  99. Call SysSleep 1
  100. Exit
  101.