home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / lsmt213c.zip / chkuser.cmd < prev    next >
OS/2 REXX Batch file  |  1998-04-24  |  5KB  |  152 lines

  1. /*---------------------------------------------------------------------------*\
  2. |   Check Password replication                (C) Alain Rykaert - DEC97-APR98 |
  3. \*---------------------------------------------------------------------------*/
  4.     Version = '1.01'
  5.          /* it's hard to say, but thanks to jacques from morgan euroclear */
  6.     Say '* CHKPWD Version' Version
  7.  
  8.     Call Init                                 /* init dll's and other stuff*/
  9.     Call SysCls
  10.  
  11.     OutFile = 'CHKUSER.LOG'                              /* Output filename*/
  12.  
  13.     TempFile = LSRDrive'\ibmlan\chkpwd.txt'               /* temporary file*/
  14.     Say '* Temporary file:' TempFile
  15.  
  16. /*===================================*/
  17.     DCName = 'serv0100'
  18.     UserID = '$pol'
  19. /*===================================*/
  20.  
  21.     RC = NetGetInfo(340, 'Server', '\\'DCName, 'Servers')
  22.     If RC = 0
  23.       Then Do
  24.              Call RxStemSort 'Server'
  25.              Say '* Total Defined servers:' Server.0
  26.              Say '* Scanning active servers...'
  27.              Call SysCurState Off
  28.              Parse Value SysCurPos() With Row Col
  29.              j = 0
  30.              Do i = 1 to Server.0
  31.                Call SysCurPos Row, 0
  32.                Color = Random(41,46)
  33.                Say ' ' i
  34.                If Stream('\\'Server.i'\ibmlan$\ibmlan.ini', 'C','Query Exists') <> ''
  35.                  Then Do
  36.                         j = j + 1
  37.                         ServerName.j = Server.i
  38.                       End
  39.                  Else Nop
  40.              End
  41.            End
  42.       Else Call ChkError RC
  43.  
  44.     ServerName.0 = j
  45.  
  46.     Do i = 1 to ServerName.0                   /* Reset all status counters*/
  47.       Status.i = ''
  48.     End
  49.  
  50.     OutText = '* Total active servers:' ServerName.0
  51.     Say OutText
  52.     Call LineOut OutFile, OutText
  53.     Call Stream  OutFile, 'C', 'Close'
  54.  
  55.     Call Time('R')
  56.     Found = 0
  57.     Loop = 0
  58.     Do Forever
  59.       If Found = ServerName.0              /* if all servers ok, then leave*/
  60.         Then Leave
  61.         Else Nop
  62.       Say Copies('-', 40) 'Loop:' Loop
  63.       Do i = 1 to ServerName.0
  64.         If Status.i <> 'OK'
  65.           Then Do
  66.                  RC = NetGetInfo(280, 'UserInfo', '\\'ServerName.i, UserID)
  67.                  If RC = 0
  68.                    Then Do
  69.                           Status.i = 'OK'
  70.                           Found = Found + 1
  71.                           Call Beep 2000,50
  72.                           Call LineOut OutFile, Time() ServerName.i
  73.                           Call Stream  OutFile, 'C', 'Close'
  74.                         End
  75.                    Else Nop
  76.                  Say '* ServerName:' i Left(ServerName.i,9) Status.i
  77.                End
  78.           Else Nop
  79.       End
  80.       Loop = Loop + 1
  81.       Call SysSleep 1
  82.     End
  83.     Say '* Total Time:' Trunc(Time('E'),2)
  84.  
  85.     Exit
  86.  
  87.  INIT:/* --------------------------------------------------------------------*/
  88.  
  89.    '@echo off'
  90.     BootDrive = Left(Value('Comspec',,'OS2Environment'),2)
  91.  
  92.     If RxFuncQuery('SysLoadFuncs')
  93.       Then Do
  94.              Call RxFuncAdd SysLoadFuncs, RexxUtil, SysLoadFuncs
  95.              Call SysLoadFuncs
  96.            End
  97.       Else Nop
  98.  
  99.     LSRDrive = ''                      /* Check for Lan Server Drive Letter*/
  100.     PPath = Translate(Value('DPATH',,'OS2Environment'))
  101.     x = Pos('\IBMLAN\NETPROG;', PPath) -2
  102.     If x > 0
  103.       Then Do
  104.              LSRDrive = SubStr(PPath, x, 2)
  105.              Say '* LanServer Drive:' LSRDrive
  106.            End
  107.       Else Do
  108.              Say '* Could not determine the Lan Requester path'
  109.              Exit
  110.            End
  111.  
  112.     Call ChkFile LSRDrive'\ibmlan\netlib\lsrxut.dll'
  113.     If RxFuncQuery('LoadLSRXUTFuncs')
  114.       Then Do
  115.              Call RxFuncAdd LoadLsRxutFuncs, LSRXUT, LoadLsRxutFuncs
  116.              Call LoadLsRxutFuncs
  117.            End
  118.       Else Nop
  119.  
  120.     Call ChkFile BootDrive'\os2\dll\rxutils.dll'
  121.     If RxFuncQuery('RxLoadFuncs')
  122.       Then Do
  123.              Call RxFuncAdd RxLoadFuncs, RXUTILS, RxLoadFuncs
  124.              Call RxLoadFuncs
  125.            End
  126.       Else Nop
  127.  
  128.     Return
  129.  
  130.  CHKERROR:/* ----------------------------------------------------------------*/
  131.  
  132.     Parse Arg RCode
  133.  
  134.     Say '* Error:' RCode
  135.     Exit X2D('1600')
  136.  
  137.     Return
  138.  
  139.  CHKFILE:/* -----------------------------------------------------------------*/
  140.  
  141.     Parse Arg File_To_Check
  142.  
  143.     If Stream(File_To_Check, 'C', 'Query Exists') = ''
  144.       Then Do
  145.              Say '! File not found:' File_To_Check
  146.              Exit
  147.            End
  148.       Else Nop
  149.  
  150.     Return
  151.  
  152.