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

  1. /*---------------------------------------------------------------------------*\
  2. |   Copy Tools & SrvTools to servers          (C) Alain Rykaert - OCT98-OCT98 |
  3. \*---------------------------------------------------------------------------*/
  4.     Version = '1.01'
  5.     Say '* LSTOOLS Version' Version
  6.  
  7.     Call Init                                 /* init dll's and other stuff*/
  8.  
  9.     Parse Upper Arg DCName
  10.  
  11.     If DCName = ''
  12.       Then Do
  13.              Say '*'
  14.              Say '* Copy Tools & SrvTools to Servers'
  15.              Say '*'
  16.              Say '* Usage: LSTOOLS {DCName}'
  17.              Say '*'
  18.              Say '* Sample: LSTOOLS \\BEDDC01'
  19.              Say '*'
  20.              Exit
  21.            End
  22.       Else Nop
  23.  
  24.     DCName = Strip(DCName,'L','\')
  25.     Say '* Server Name:' '\\'DCName
  26.  
  27.     RC = NetGetInfo(370, 'ServerModalInfo', '\\'DCName)  /* get server role*/
  28.     If RC = 0
  29.       Then Do
  30.              ServerRole = ServerModalInfo.Role
  31.              If WordPos('Primary', ServerRole) > 0     /* check server role*/
  32.                Then Nop
  33.                Else Do
  34.                       Say '! This is not a Primary Domain Controller' '07'x
  35.                       Exit
  36.                     End
  37.            End
  38.       Else Say RC
  39.  
  40.     RC = NetGetInfo(340, 'ServerName', '\\'DCName, 'Servers')/* get all servers*/
  41.     If RC = 0
  42.       Then Do
  43.              Call RxStemSort 'ServerName'
  44.              Say '* Total defined servers:' ServerName.0
  45.              Do i = 1 to ServerName.0
  46.                Counter = '('Right(i,Length(ServerName.0))'/'Right(ServerName.0,Length(ServerName.0))')'
  47.                Say '* ServerName:' Counter ServerName.i
  48.                If NetGetInfo(370, 'ServerModalInfo', '\\'ServerName.i) = 0 &,
  49.                  Stream('\\'ServerName.i'\ibmlan$\ibmlan.ini', 'C', 'Query Exists') <> ''
  50.                  Then Call CCopy ServerName.i
  51.                  Else Say '09'x '> not found'
  52.              End
  53.            End
  54.       Else Say RC
  55.  
  56.     Exit
  57.  
  58.  CCOPY: /* ----------------------------------------------------------------*/
  59.  
  60.     Parse Arg ServerName
  61.     If Stream('\\'ServerName'\c$\os2\install\ipl.log', 'C', 'Query Exist') <> ''
  62.       Then Do
  63.             'net use s: /d >nul 2>nul'
  64.             'net use s: \\'ServerName'\c$ >nul'
  65.             'ccp -sf \\m_cidsrv\f$\sharea\mir\tools s:\'
  66.             'ccp -sf \\m_cidsrv\f$\sharea\mir\srvtools s:\ibmlan'
  67.             'net use s: /d >nul'
  68.            End
  69.       Else Say '09'x '> No New Installed CID Server'
  70.  
  71.    'net use \\'ServerName'\c$ /d >nul 2>nul'
  72.    'net use \\'ServerName'\ipc$ /d >nul 2>nul'
  73.    'net use \\'ServerName'\ibmlan$ /d >nul 2>nul'
  74.  
  75.     Return
  76.  
  77.  INIT:/* --------------------------------------------------------------------*/
  78.  
  79.    '@echo off'
  80.  
  81.     If Value('TREES',,'OS2Environment') = ''           /* Check for Tracing*/
  82.       Then Trace = 0
  83.       Else Trace = 1
  84.  
  85.     BootDrive = Left(Value('Comspec',,'OS2Environment'),2)
  86.  
  87.     Redir = '>nul'
  88.  
  89.     If RxFuncQuery('SysLoadFuncs')
  90.       Then Do
  91.              Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  92.              Call SysLoadFuncs
  93.            End
  94.       Else Nop
  95.  
  96.     LSRDrive = ''                      /* Check for Lan Server Drive Letter*/
  97.     PPath = Translate(Value('PATH',,'OS2Environment'))
  98.     x = Pos('\IBMLAN\NETPROG;', PPath) -2
  99.     If x > 0
  100.       Then LSRDrive = SubStr(PPath, x, 2)
  101.       Else Do
  102.              Say '* Could not determine the Lan Requester path'
  103.              Exit
  104.            End
  105.  
  106.     Call ChkFile LSRDrive'\ibmlan\netlib\lsrxut.dll'
  107.     If RxFuncQuery('LoadLSRXUTFuncs')
  108.       Then Do
  109.              Call RxFuncAdd 'LoadLsRxutFuncs', 'LSRXUT', 'LoadLsRxutFuncs'
  110.              Call LoadLsRxutFuncs
  111.            End
  112.       Else Nop
  113.  
  114.     Call ChkFile BootDrive'\os2\dll\rxutils.dll'
  115.     If RxFuncQuery('RxLoadFuncs')
  116.       Then Do
  117.              Call RxFuncAdd 'RxLoadFuncs', 'RXUTILS', 'RxLoadFuncs'
  118.              Call RxLoadFuncs
  119.            End
  120.       Else Nop
  121.  
  122.     TempFile = LSRDrive'\ibmlan\lstools.tmp'              /* Temporary file*/
  123.  
  124.     Return
  125.  
  126.  CHKFILE:/* -----------------------------------------------------------------*/
  127.  
  128.     Parse Arg File_To_Check
  129.  
  130.     If Stream(File_To_Check, 'C', 'Query Exists') = ''
  131.       Then Do
  132.              Say '! File not found:' File_To_Check
  133.              Exit
  134.            End
  135.       Else Nop
  136.  
  137.     Return
  138.  
  139.  LOGIT:/* -------------------------------------------------------------------*/
  140.  
  141.     Parse Arg OutFileName OutText
  142.  
  143.     If LineOut(OutFileName, OutText) = 0
  144.       Then Call Stream OutFileName, 'C', 'Close'
  145.       Else Say '! Error while writing:' OutFileName '07'x
  146.  
  147.     Return
  148.  
  149.