home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / w / wrb100a.zip / WR.BAT < prev    next >
DOS Batch File  |  1993-01-02  |  7KB  |  137 lines

  1. @ECHO OFF
  2. REM
  3. REM  ┌─────────────────────────────────────────────────────────────────────┐
  4. REM  │ This is the batch file which controls the WR-BBS program.  Although │
  5. REM  │ WR-BBS can be run from the command line,  without  a file like this │
  6. REM  │ one, the use of WR.BAT is STRONGLY urged. There are several reasons │
  7. REM  │ why WR-BBS can terminate:                                           │
  8. REM  │                                                                     │
  9. REM  │     - Scheduled termination to run an event.                        │
  10. REM  │                                                                     │
  11. REM  │     - Normal termination due to shutdown request from keyboard.     │
  12. REM  │                                                                     │
  13. REM  │     - Unexpected termination due to an error.                       │
  14. REM  │                                                                     │
  15. REM  │ For each of the possible termination reasons,   WR-BBS sets the DOS │
  16. REM  │ ERRORLEVEL to a specific value before it actually terminates.  This │
  17. REM  │ batch file uses that  information to branch to an appropriate label │
  18. REM  │ and invoke another program (for an event or door),   restart WR-BBS │
  19. REM  │ (if termination was due to an error),  or  return  to the operating │
  20. REM  │ system prompt (in case of normal shutdown).                         │
  21. REM  │                                                                     │
  22. REM  │ Please see the WR-DOS documentation for a detail description of the │
  23. REM  │ ERRORLEVEL values that WR-BBS sets for each type of termination.    │
  24. REM  └─────────────────────────────────────────────────────────────────────┘
  25. REM
  26. REM
  27. REM      If the batch file has just been started, or if an error has caused   
  28. REM      WR-BBS to terminate, control will be branched to the label STARTBBS
  29. REM      which appears below.  When control is passed to that label, WR.BAT
  30. REM      does the following:
  31. REM
  32. REM          It runs the utility program WDELAY, which gives the local SysOp
  33. REM          a chance to abort the startup (or restart) if desired.  If the 
  34. REM          startup (or restart) is happpening "unattended", such as after
  35. REM          a power failure, or system error, when nobody is at the local
  36. REM          console, then after 15 seconds, WDELAY starts the program by
  37. REM          terminating with an ERRORLEVEL of 0. 
  38. REM
  39. REM          WR.BAT is designed so that an ERRORLEVEL of zero at this point
  40. REM          will continue with the start (or restart) of WR-BBS.  If the
  41. REM          SysOp presses ESC at the local keyboard while WDELAY is running,
  42. REM          then WDELAY terminates, setting the ERRORLEVEL to 1.  WR.BAT 
  43. REM          will then react by branching to to the FINISHED label, without
  44. REM          starting WR-BBS.
  45. REM
  46. REM          If the local SysOp presses ENTER while WDELAY is running, then
  47. REM          WDELAY terminates immediately, setting the ERRORLEVEL to zero.
  48. REM          WR.BAT reacts by starting WR-BBS, just as if a default timeout
  49. REM          had occurred in WDELAY.
  50. REM
  51. REM          For more detailed information on WDELAY, please read WDELAY.DOC.
  52. REM
  53. REM
  54. :STARTBBS
  55. ECHO.
  56. ECHO.
  57. ECHO ╔═══════════════════════════════════╗
  58. ECHO ║  WR-BBS will start in 15 seconds  ║
  59. ECHO ╚═══════════════════════════════════╝
  60. ECHO.
  61. ECHO.
  62. WDELAY 15
  63. IF ERRORLEVEL 1 GOTO FINISHED
  64. REM
  65. REM      Start WR-BBS
  66. REM
  67. WRBBS
  68. REM
  69. REM      WR-BBS has been started.  When WR-BBS terminates, the following 
  70. REM      lines will examine the ERRORLEVEL and branch control to the 
  71. REM      appropriate label in WR.BAT.
  72. REM
  73. IF ERRORLEVEL 100 GOTO STARTBBS
  74. IF ERRORLEVEL 84 GOTO RUNEVENT
  75. IF ERRORLEVEL 1 GOTO STARTBBS
  76. REM
  77. REM      An ERRORLEVEL of zero means that WR-BBS terminated normally, in
  78. REM      repsonse to an ALT-Q (quit) request from the keyboard.
  79. REM
  80. IF ERRORLEVEL 0 GOTO FINISHED
  81. :RUNEVENT
  82. REM
  83. REM      If control branches to the RUNEVENT label, this means that WR-BBS 
  84. REM      terminated with an ERRORLEVEL between 84 and 99.  In WRCONFIG.SYS,
  85. REM      you can optionally schedule up to 16 events that WR-BBS executes
  86. REM      after a configured time each day or on certain days.  Each event
  87. REM      can be set as a "shell" event or a "terminate" event.  When a shell
  88. REM      event runs, WR.BAT plays no part in the control of that event, since
  89. REM      WR-BBS stays loaded in memory and simply shells to the operating
  90. REM      system to run the event program.  When the event program finishes,
  91. REM      WR-BBS resumes normal operation.
  92. REM
  93. REM      A "terminate" event, however, is executed much differently.  When a
  94. REM      terminate event occurs, WR-BBS completely terminates, and sets the
  95. REM      ERRORLEVEL to a value between 86 and 99.  The actual value that is
  96. REM      set, depends on what you have configured in WRCONFIG.SYS.  Please
  97. REM      read the WR-BBS documentation for detailed information on setting
  98. REM      up terminate events.
  99. REM
  100. REM      IMPORTANT:  If the terminate event runs another batch file (outside
  101. REM                  of WR.BBS), you must do one of the following, so that
  102. REM                  WR-BBS will automatically restart when the event is 
  103. REM                  finished:
  104. REM
  105. REM                  1.  Use the DOS CALL keyword to call the other batch 
  106. REM                      file from WR.BAT.  Using CALL allows control to 
  107. REM                      return to WR.BAT after the other batch file has
  108. REM                      completed.  Without the CALL command, the parent
  109. REM                      batch file (this one, WR.BAT) no longer has control
  110. REM                      and the system will sit idle after the event.
  111. REM
  112. REM                  2.  At the end of the other batch file (the one that
  113. REM                      runs the event), restart WR.BAT by changing back to
  114. REM                      the WR-BBS home directory and then running (without
  115. REM                      a CALL) the batch file WR.BAT.
  116. REM
  117. REM                  Attention is necessary to ensure that you do not CALL
  118. REM                  or run WR.BAT while WR.BAT still has control.  This will
  119. REM                  cause various unexpected problems.
  120. REM
  121. REM      (Put your event's command lines in place of the dummy names below)
  122. REM
  123. IF ERRORLEVEL 98 CALL DUMMY1.BAT
  124. IF ERRORLEVEL 95 SAMPLE2.EXE
  125. IF ERRORLEVEL 87 DUMMY3.BAT
  126. REM
  127. REM      Do not remove the line below.  It will restart WR-BBS after an event
  128. REM      is called on one the above lines, or if there is (erroneously) no
  129. REM      definition for the particular ERRORLEVEL.
  130. REM
  131. GOTO STARTBBS
  132. :FINISHED
  133. ECHO.
  134. ECHO WR.BAT has terminated.
  135. ECHO.
  136.  
  137.