/*---------------------------------------------------------------------------*\
|   GetBack Online                            (C) Alain Rykaert - NOV97-NOV97 |
\*---------------------------------------------------------------------------*/
    Version = '1.01'

  /*==============================*/
    ServerName = 'PS02'
    IPAddress  = '8.1.1.87'
    MACAddress = '4000232000A7'
  /*==============================*/

    Call Init
    Call Time('R')
    Call MACPing MACAddress
    Call IPPing IPAddress
    Call REQPing ServerName
    Call SRVPing ServerName
    Exit

 MACPING:/* ----------------------------------------------------------------*/

    Parse Arg Address

    Say '* Checking MACAddress' Address

    Do Forever
     'os2ping /a='Address '/r /w=1 2>nul | Find "No responses"' Redir
      If RC = 0                        /* MAC not found                    */
        Then Call SysSleep 1
        Else Do
               Say ' ' Trunc(Time('E'),2)
               Leave
             End
    End

    Return

 IPPING:/* -----------------------------------------------------------------*/

    Parse Arg Address

    Say '* Checking IP' Address

    Do Forever
     'ping' Address '9 1 2>nul | Find "0 packets received"' Redir
      If RC = 0                        /* IP not found                     */
        Then Call SysSleep 1
        Else Do
               Say ' ' Trunc(Time('E'),2)
               Leave
             End
    End

    Return

 REQPING:/* -------------------------------------------------------------------*/

    Parse Arg NetName

    Say '* Checking NetName as a Requester' NetName

    Do Forever
     'netping' NetName '/q' Redir
      If RC = 0                        /* Server OK                        */
        Then Do
               Say ' ' Trunc(Time('E'),2)
               Leave
             End
        Else Call SysSleep 1

    End

    Return

 SRVPING:/* -------------------------------------------------------------------*/

    Parse Arg NetName

    Say '* Checking NetName as a Server' NetName

    Do Forever
     'netping' NetName '/v' Redir
      If RC = 0                        /* Server OK                        */
        Then Do
               Say ' ' Trunc(Time('E'),2)
               Leave
             End
        Else Call SysSleep 1

    End

    Return

 INIT:/* -------------------------------------------------------------------*/

   '@echo off'
    Redir = '>nul 2>nul'

    If RxFuncQuery('SysLoadFuncs')
      Then Do
             Call RxFuncAdd SysLoadFuncs, RexxUtil, SysLoadFuncs
             Call SysLoadFuncs
           End
      Else Nop

    Return

