home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / EVENTS / MEVENT.ZIP / MEVENT.BAT < prev    next >
DOS Batch File  |  1992-08-22  |  9KB  |  199 lines

  1. @echo off
  2.  
  3. REM  This batch file designed by Filo to assist Sysops who wish to have
  4. REM  or attempt to have multiple-events in WWIV.  It utilizes a program
  5. REM  called ERRLEVEL to determine the hours and days of the week to
  6. REM  allow you the greatest lattitude in configuring your events.
  7. REM  This program is triggered when a user logs off, so it is not as
  8. REM  flexible as a true event scheduler which would force an event to
  9. REM  happen.  I will later investigate the possibility of a source
  10. REM  code mod which will force the BBS to check a schedule of events.
  11.  
  12. REM  IMPORTANT:  ERRLEVEL.EXE MUST be in your PATH or in the directory
  13. REM  where you place this batch file.  I recommend that you place this
  14. REM  batch file in your BBS directory.  I am writing it with that
  15. REM  assumption.
  16.  
  17. REM  The batchfile also is organized into sections based on first the
  18. REM  weekend vs weekday vs Always.  Then it is organized based on time.
  19.  
  20. REM  The weekend definition uses a start time of 11pm Friday and ends
  21. REM  at 5am Monday.  This will cover the normal 'cheap' operating hours
  22. REM  for weekend rates of most LD servers.
  23.  
  24. REM  ALWAYS is something that you want to happen after each user logs 
  25. REM  off.
  26.  
  27. REM  WeekDay is for the time period 6am Monday to 11pm Friday.
  28.  
  29. :START
  30. REM  START is the first line of this batch file (called a LABEL).
  31. REM  Consult DOCS on how BEGIN DAY EVENT should be defined.
  32.  
  33. errlevel w
  34. REM  The w command has it return an errorlevel based on day of WEEK
  35. REM  Errorlevels of 1 (Sunday) to 7 (Saturday) are returned.
  36.  
  37.   if errorlevel 8 goto BATCHERR        REM There was an error
  38.   if errorlevel 7 goto WeekEND
  39.   if errorlevel 6 goto MayBe           REM Further checking to occur
  40.   if errorlevel 2 goto WeekDay         REM (covers errorlevels 2-5
  41.   if errorlevel 1 goto WeekEND
  42.   if errorlevel 0 goto BATCHERR        REM There was an error
  43.  
  44. :BATCHERR
  45. echo           There was an Error in the Batch File
  46. echo           BATCH ERROR >ERR.TXT
  47.  
  48. REM           If errors occur, ERR.TXT will exist.  Check occassionally to
  49. REM           make sure it is not there.  IF it is, check batch file but
  50. REM           also DELETE ERR.TXT so that you will know if other errors
  51. REM           occur.
  52.  
  53. if exist err.txt goto RUN_ERR
  54. goto START
  55.  
  56. :MayBe
  57. errorlevel h
  58.   if errorlevel 23 goto WeekEND
  59.   if errorlevel 0 goto WeekDay
  60.  
  61. :WeekEND
  62. REM  I recommend that you use CALL STATEMENTS to CALL your EXTERNAL EVENT
  63. REM  rather than have it defined to run from the board in INIT.
  64.  
  65. REM  What I am going to put here are some examples.  Feel free to alter
  66. REM  them to fit your purpose.  Each example will be explained.
  67.  
  68. REM  The examples here are based on your using NET31.  NET32 does not 
  69. REM  require the use of SET WWIV_NET= type statements; instead it supports
  70. REM  statements of the type 'network .1  to do the 2nd network.  See
  71. REM  accompanying doc file for more discussion of the NET32 operations.
  72.  
  73. errlevel h
  74.  
  75. REM  Always TEST from highest number down.  h can have values 0 to 23
  76.  
  77.   if errorlevel 24 goto BATCHERR
  78.   if errorlevel 22 call DO_1040.BAT   REM  See docs on this
  79.   if errorlevel 22 goto BBS           REM  After calling 1040 ...run BBS
  80.   if errorlevel 21 goto BBS           REM  Nothing happens...run BBS
  81.   if errorlevel 20 goto BBS           REM  Nothing happens...run BBS
  82.   if errorlevel 19 call DO_1050.BAT   REM  See docs on this
  83.   if errorlevel 19 goto BBS           REM  After calling 1050 ...run BBS
  84.   if errorlevel 18 goto BBS           REM  Nothing happens...run BBS
  85.   if errorlevel 17 goto EXT_EVT       REM  Check on EXTERNAL EVENT
  86.   if errorlevel 17 goto BBS
  87.   if errorlevel 16 goto BBS           REM  Nothing happens...run BBS
  88.   if errorlevel 15 goto BBS           REM  Nothing happens...run BBS
  89.   if errorlevel 14 goto BBS           REM  Nothing happens...run BBS
  90.   if errorlevel 13 goto BBS           REM  Nothing happens...run BBS
  91.   if errorlevel 12 goto BBS           REM  Nothing happens...run BBS
  92.   if errorlevel 11 goto BBS           REM  Nothing happens...run BBS
  93.   if errorlevel 10 CALL DO_LOCAL.BAT  REM  See docs on this
  94.   if errorlevel 10 goto BBS           REM  Nothing happens...run BBS
  95.   if errorlevel 9  goto BBS           REM  Nothing happens...run BBS
  96.   if errorlevel 8  goto BBS           REM  Nothing happens...run BBS
  97.   if errorlevel 7  goto BBS           REM  Nothing happens...run BBS
  98.   if errorlevel 6  goto BBS           REM  Nothing happens...run BBS
  99.   if errorlevel 5  call DO_1040.BAT   REM  Call 1040 and ....run BBS
  100.   if errorlevel 5  goto BBS           REM  Nothing happens...run BBS
  101.   if errorlevel 4  call DO_1050.BAT   REM  Call 1050 and ....run BBS
  102.   if errorlevel 4  goto BBS
  103.   if errorlevel 3  goto BBS           REM  Nothing happens...run BBS
  104.   if errorlevel 2  CALL_LD.BAT        REM  Call Special LD batch file
  105.   if errorlevel 2  goto BBS           REM  Nothing happens...run BBS
  106.   if errorlevel 1  goto BBS           REM  Nothing happens...run BBS
  107.   if errorlevel 1  goto BBS           REM  Nothing happens...run BBS
  108.   if errorlevel 0  goto BBS           REM  Nothing happens...run BBS
  109. goto START
  110.  
  111. :WeekDay
  112.   if errorlevel 24 goto BATCHERR
  113.   if errorlevel 23 goto BBS           REM  Nothing happens...run BBS
  114.   if errorlevel 22 call DO_1040.BAT   REM  See docs on this
  115.   if errorlevel 22 goto BBS           REM  After calling 1040 ...run BBS
  116.   if errorlevel 21 goto BBS           REM  Nothing happens...run BBS
  117.   if errorlevel 20 goto BBS           REM  Nothing happens...run BBS
  118.   if errorlevel 19 call DO_1050.BAT   REM  See docs on this
  119.   if errorlevel 19 goto BBS           REM  After calling 1050 ...run BBS
  120.   if errorlevel 18 goto BBS           REM  Nothing happens...run BBS
  121.   if errorlevel 17 goto EXT_EVT       REM  Check on EXTERNAL EVENT
  122.   if errorlevel 17 goto BBS
  123.   if errorlevel 16 goto BBS           REM  Nothing happens...run BBS
  124.   if errorlevel 15 goto BBS           REM  Nothing happens...run BBS
  125.   if errorlevel 14 goto BBS           REM  Nothing happens...run BBS
  126.   if errorlevel 13 goto BBS           REM  Nothing happens...run BBS
  127.   if errorlevel 12 goto BBS           REM  Nothing happens...run BBS
  128.   if errorlevel 11 goto BBS           REM  Nothing happens...run BBS
  129.   if errorlevel 10 CALL DO_LOCAL.BAT  REM  See docs on this
  130.   if errorlevel 10 goto BBS           REM  Nothing happens...run BBS
  131.   if errorlevel 9  goto BBS           REM  Nothing happens...run BBS
  132.   if errorlevel 8  goto BBS           REM  Nothing happens...run BBS
  133.   if errorlevel 7  goto BBS           REM  Nothing happens...run BBS
  134.   if errorlevel 6  goto BBS           REM  Nothing happens...run BBS
  135.   if errorlevel 5  call DO_1040.BAT   REM  Call 1040 and ....run BBS
  136.   if errorlevel 5  goto BBS           REM  Nothing happens...run BBS
  137.   if errorlevel 4  call DO_1050.BAT   REM  Call 1050 and ....run BBS
  138.   if errorlevel 4  goto BBS
  139.   if errorlevel 3  goto BBS           REM  Nothing happens...run BBS
  140.   if errorlevel 2  call DO_LD.BAT     REM  Call Special LD boards
  141.   if errorlevel 2  goto BBS           REM  Nothing happens...run BBS
  142.   if errorlevel 1  goto BBS           REM  Nothing happens...run BBS
  143.   if errorlevel 1  goto BBS           REM  Nothing happens...run BBS
  144.   if errorlevel 0  goto BBS           REM  Nothing happens...run BBS
  145. goto START
  146.  
  147. REM  Since this is just an example file, I got lazy and duplicated the
  148. REM  WeekEND label under the WeekDay label.  Generally you would want
  149. REM  to allow more LD calls on weekends and at different times than
  150. REM  on weekdays.  You could also have more special events which did
  151. REM  maintainance and so forth.
  152.  
  153. :EXT_EVT
  154.   
  155.   if exist EXT_EVT.FLG call EEVENT.BAT   REM Assumed name of EXTERNAL EVENT BAT
  156.   goto BBS
  157.  
  158. REM  If the Flag does not exist it runs the BBS; if it exists it runs the
  159. REM  external event.  The Flag is to prevent the event from running more than
  160. REM  once.
  161.  
  162. :BBS
  163. REM  This is the label that runs your BBS...
  164. echo                Loading WWIV now !
  165.  
  166. bbs /A1 /N0 /O          REM  This can also be bbs -A1 -N0 -O
  167.   
  168.   if exist bbs_err.txt goto QUIT
  169.   if errorlevel 1 echo BBS error>bbs_err.txt
  170.   if errorlevel 0 goto START
  171.  
  172. REM  The errorlevel of 1 is forced by /A1...bbs gives an errorlevel of 1
  173. REM  on an abnormal exit.  It gives an errorlevel of 0 if everything is ok
  174.  
  175. :QUIT
  176.  
  177. REM  End of batch file.  Normally this would only be reached if bbs exits
  178. REM  twice with an abnormal errorlevel.  Assumption is that if something is
  179. REM  wrong and it is repeated, you want to quit and shut down.
  180.  
  181. echo                        BBS Shut Down 
  182. echo .
  183. echo .
  184. echo    An abnormal exit error occurred twice.  Please investigate !
  185. echo .
  186. echo .
  187. echo .
  188. echo                    S Y S O P   A L E R T
  189. echo .
  190.  
  191. REM   Think it will get your attention to find the echoed message above on
  192. REM   your screen ?
  193.  
  194. REM  Questions on this setup may be addressed to Filo at the following
  195. REM  WWIV based addresses:
  196. REM     1 @5252  WWIVnet, WWIVlink, IceNET, FireNET
  197. REM     1:397/5252 FidoNet
  198. REM     dd-ii.UUCP  UseNet
  199.