home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / lsmt213c.zip / getback.cmd < prev    next >
OS/2 REXX Batch file  |  1998-01-17  |  3KB  |  108 lines

  1. /*---------------------------------------------------------------------------*\
  2. |   GetBack Online                            (C) Alain Rykaert - NOV97-NOV97 |
  3. \*---------------------------------------------------------------------------*/
  4.     Version = '1.01'
  5.  
  6.   /*==============================*/
  7.     ServerName = 'PS02'
  8.     IPAddress  = '8.1.1.87'
  9.     MACAddress = '4000232000A7'
  10.   /*==============================*/
  11.  
  12.     Call Init
  13.     Call Time('R')
  14.     Call MACPing MACAddress
  15.     Call IPPing IPAddress
  16.     Call REQPing ServerName
  17.     Call SRVPing ServerName
  18.     Exit
  19.  
  20.  MACPING:/* ----------------------------------------------------------------*/
  21.  
  22.     Parse Arg Address
  23.  
  24.     Say '* Checking MACAddress' Address
  25.  
  26.     Do Forever
  27.      'os2ping /a='Address '/r /w=1 2>nul | Find "No responses"' Redir
  28.       If RC = 0                        /* MAC not found                    */
  29.         Then Call SysSleep 1
  30.         Else Do
  31.                Say ' ' Trunc(Time('E'),2)
  32.                Leave
  33.              End
  34.     End
  35.  
  36.     Return
  37.  
  38.  IPPING:/* -----------------------------------------------------------------*/
  39.  
  40.     Parse Arg Address
  41.  
  42.     Say '* Checking IP' Address
  43.  
  44.     Do Forever
  45.      'ping' Address '9 1 2>nul | Find "0 packets received"' Redir
  46.       If RC = 0                        /* IP not found                     */
  47.         Then Call SysSleep 1
  48.         Else Do
  49.                Say ' ' Trunc(Time('E'),2)
  50.                Leave
  51.              End
  52.     End
  53.  
  54.     Return
  55.  
  56.  REQPING:/* -------------------------------------------------------------------*/
  57.  
  58.     Parse Arg NetName
  59.  
  60.     Say '* Checking NetName as a Requester' NetName
  61.  
  62.     Do Forever
  63.      'netping' NetName '/q' Redir
  64.       If RC = 0                        /* Server OK                        */
  65.         Then Do
  66.                Say ' ' Trunc(Time('E'),2)
  67.                Leave
  68.              End
  69.         Else Call SysSleep 1
  70.  
  71.     End
  72.  
  73.     Return
  74.  
  75.  SRVPING:/* -------------------------------------------------------------------*/
  76.  
  77.     Parse Arg NetName
  78.  
  79.     Say '* Checking NetName as a Server' NetName
  80.  
  81.     Do Forever
  82.      'netping' NetName '/v' Redir
  83.       If RC = 0                        /* Server OK                        */
  84.         Then Do
  85.                Say ' ' Trunc(Time('E'),2)
  86.                Leave
  87.              End
  88.         Else Call SysSleep 1
  89.  
  90.     End
  91.  
  92.     Return
  93.  
  94.  INIT:/* -------------------------------------------------------------------*/
  95.  
  96.    '@echo off'
  97.     Redir = '>nul 2>nul'
  98.  
  99.     If RxFuncQuery('SysLoadFuncs')
  100.       Then Do
  101.              Call RxFuncAdd SysLoadFuncs, RexxUtil, SysLoadFuncs
  102.              Call SysLoadFuncs
  103.            End
  104.       Else Nop
  105.  
  106.     Return
  107.  
  108.