home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / ftpfid17.zip / CSPPP.CMD next >
OS/2 REXX Batch file  |  1996-09-14  |  2KB  |  72 lines

  1. /* CSPPP.CMD */
  2. '@echo off'
  3. hangflg = 'f:\bbs\logs\hangup.flg' /* hangup flag */
  4. flg = 'f:\bbs\logs\ppp.flg' /* process flag */
  5. tcpbin = 'd:\tcpip\bin'
  6. signal on halt
  7.  
  8. share = 'OS2ENVIRONMENT'
  9. Task = value('Task',,share) /* You need to SET TASK =  in your mailer's cmd */
  10.  
  11. if RxFuncQuery("SysLoadFuncs") then
  12.    do
  13.    rc = RxFuncAdd("SysLoadFuncs","RexxUtil","SysLoadFuncs")
  14.    rc = SysLoadFuncs()
  15.    end
  16.  
  17. IF Stream(flg,'C', 'Query Exists') <>' ' Then
  18.     Do
  19.      say '!Must be running already.'
  20.     exit
  21.     end
  22. else
  23.  do
  24.  rc = stream(flg,'C','open write') /* Set process flag */
  25. if rc <> 'READY:' Then
  26.     Do
  27.   say ansi_red '!Error creating process flag.' ansi_normal
  28.   rc = lineout(logfile,'!Error creating process flag.')
  29.     exit
  30.     end
  31.  rc = stream(flg,'C','close')
  32.  end
  33.  
  34. del hangflg' > nul: 2>&1'
  35.  
  36. call syssleep 3
  37. New = Directory(tcpbin)
  38.  
  39. do forever
  40.  
  41. if task = 01 then do
  42. 'set MinCarrier = 24000'
  43. 'ppp.exe com2 57600 rtscts modem defaultroute exit notify connect "pppdial.cmd csppp.rsp"'
  44.    end
  45.  else do
  46. 'set MinCarrier = 14400'
  47. 'ppp.exe com3 38400 rtscts modem defaultroute exit notify connect "pppdial.cmd csppp2.rsp"'
  48.  end
  49.  
  50. say 'PPP return code' rc
  51. IF Stream(hangflg,'C', 'Query Exists') <>' ' Then
  52.     Do
  53.      say '!Time to go!!!!!'
  54.     signal halt
  55.     end
  56. say 'Sleeping 60 secs. before restarting PPP.'
  57. call syssleep 60
  58. end
  59.  
  60. halt:
  61. say 'Sleeping 60 sec. before shutting down.'
  62. call syssleep 60
  63.  
  64.         /* remove process flag */
  65.       'del 'flg '> nul: 2>&1'
  66.        IF rc <> 0 Then say '!Error deleting 'flg''
  67.  
  68.       'del 'hangflg '> nul: 2>&1'
  69.        IF rc <> 0 Then say '!Error deleting 'hangflg''
  70. exit
  71.  
  72.