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 >
Wrap
DOS Batch File
|
1992-08-22
|
9KB
|
199 lines
@echo off
REM This batch file designed by Filo to assist Sysops who wish to have
REM or attempt to have multiple-events in WWIV. It utilizes a program
REM called ERRLEVEL to determine the hours and days of the week to
REM allow you the greatest lattitude in configuring your events.
REM This program is triggered when a user logs off, so it is not as
REM flexible as a true event scheduler which would force an event to
REM happen. I will later investigate the possibility of a source
REM code mod which will force the BBS to check a schedule of events.
REM IMPORTANT: ERRLEVEL.EXE MUST be in your PATH or in the directory
REM where you place this batch file. I recommend that you place this
REM batch file in your BBS directory. I am writing it with that
REM assumption.
REM The batchfile also is organized into sections based on first the
REM weekend vs weekday vs Always. Then it is organized based on time.
REM The weekend definition uses a start time of 11pm Friday and ends
REM at 5am Monday. This will cover the normal 'cheap' operating hours
REM for weekend rates of most LD servers.
REM ALWAYS is something that you want to happen after each user logs
REM off.
REM WeekDay is for the time period 6am Monday to 11pm Friday.
:START
REM START is the first line of this batch file (called a LABEL).
REM Consult DOCS on how BEGIN DAY EVENT should be defined.
errlevel w
REM The w command has it return an errorlevel based on day of WEEK
REM Errorlevels of 1 (Sunday) to 7 (Saturday) are returned.
if errorlevel 8 goto BATCHERR REM There was an error
if errorlevel 7 goto WeekEND
if errorlevel 6 goto MayBe REM Further checking to occur
if errorlevel 2 goto WeekDay REM (covers errorlevels 2-5
if errorlevel 1 goto WeekEND
if errorlevel 0 goto BATCHERR REM There was an error
:BATCHERR
echo There was an Error in the Batch File
echo BATCH ERROR >ERR.TXT
REM If errors occur, ERR.TXT will exist. Check occassionally to
REM make sure it is not there. IF it is, check batch file but
REM also DELETE ERR.TXT so that you will know if other errors
REM occur.
if exist err.txt goto RUN_ERR
goto START
:MayBe
errorlevel h
if errorlevel 23 goto WeekEND
if errorlevel 0 goto WeekDay
:WeekEND
REM I recommend that you use CALL STATEMENTS to CALL your EXTERNAL EVENT
REM rather than have it defined to run from the board in INIT.
REM What I am going to put here are some examples. Feel free to alter
REM them to fit your purpose. Each example will be explained.
REM The examples here are based on your using NET31. NET32 does not
REM require the use of SET WWIV_NET= type statements; instead it supports
REM statements of the type 'network .1 to do the 2nd network. See
REM accompanying doc file for more discussion of the NET32 operations.
errlevel h
REM Always TEST from highest number down. h can have values 0 to 23
if errorlevel 24 goto BATCHERR
if errorlevel 22 call DO_1040.BAT REM See docs on this
if errorlevel 22 goto BBS REM After calling 1040 ...run BBS
if errorlevel 21 goto BBS REM Nothing happens...run BBS
if errorlevel 20 goto BBS REM Nothing happens...run BBS
if errorlevel 19 call DO_1050.BAT REM See docs on this
if errorlevel 19 goto BBS REM After calling 1050 ...run BBS
if errorlevel 18 goto BBS REM Nothing happens...run BBS
if errorlevel 17 goto EXT_EVT REM Check on EXTERNAL EVENT
if errorlevel 17 goto BBS
if errorlevel 16 goto BBS REM Nothing happens...run BBS
if errorlevel 15 goto BBS REM Nothing happens...run BBS
if errorlevel 14 goto BBS REM Nothing happens...run BBS
if errorlevel 13 goto BBS REM Nothing happens...run BBS
if errorlevel 12 goto BBS REM Nothing happens...run BBS
if errorlevel 11 goto BBS REM Nothing happens...run BBS
if errorlevel 10 CALL DO_LOCAL.BAT REM See docs on this
if errorlevel 10 goto BBS REM Nothing happens...run BBS
if errorlevel 9 goto BBS REM Nothing happens...run BBS
if errorlevel 8 goto BBS REM Nothing happens...run BBS
if errorlevel 7 goto BBS REM Nothing happens...run BBS
if errorlevel 6 goto BBS REM Nothing happens...run BBS
if errorlevel 5 call DO_1040.BAT REM Call 1040 and ....run BBS
if errorlevel 5 goto BBS REM Nothing happens...run BBS
if errorlevel 4 call DO_1050.BAT REM Call 1050 and ....run BBS
if errorlevel 4 goto BBS
if errorlevel 3 goto BBS REM Nothing happens...run BBS
if errorlevel 2 CALL_LD.BAT REM Call Special LD batch file
if errorlevel 2 goto BBS REM Nothing happens...run BBS
if errorlevel 1 goto BBS REM Nothing happens...run BBS
if errorlevel 1 goto BBS REM Nothing happens...run BBS
if errorlevel 0 goto BBS REM Nothing happens...run BBS
goto START
:WeekDay
if errorlevel 24 goto BATCHERR
if errorlevel 23 goto BBS REM Nothing happens...run BBS
if errorlevel 22 call DO_1040.BAT REM See docs on this
if errorlevel 22 goto BBS REM After calling 1040 ...run BBS
if errorlevel 21 goto BBS REM Nothing happens...run BBS
if errorlevel 20 goto BBS REM Nothing happens...run BBS
if errorlevel 19 call DO_1050.BAT REM See docs on this
if errorlevel 19 goto BBS REM After calling 1050 ...run BBS
if errorlevel 18 goto BBS REM Nothing happens...run BBS
if errorlevel 17 goto EXT_EVT REM Check on EXTERNAL EVENT
if errorlevel 17 goto BBS
if errorlevel 16 goto BBS REM Nothing happens...run BBS
if errorlevel 15 goto BBS REM Nothing happens...run BBS
if errorlevel 14 goto BBS REM Nothing happens...run BBS
if errorlevel 13 goto BBS REM Nothing happens...run BBS
if errorlevel 12 goto BBS REM Nothing happens...run BBS
if errorlevel 11 goto BBS REM Nothing happens...run BBS
if errorlevel 10 CALL DO_LOCAL.BAT REM See docs on this
if errorlevel 10 goto BBS REM Nothing happens...run BBS
if errorlevel 9 goto BBS REM Nothing happens...run BBS
if errorlevel 8 goto BBS REM Nothing happens...run BBS
if errorlevel 7 goto BBS REM Nothing happens...run BBS
if errorlevel 6 goto BBS REM Nothing happens...run BBS
if errorlevel 5 call DO_1040.BAT REM Call 1040 and ....run BBS
if errorlevel 5 goto BBS REM Nothing happens...run BBS
if errorlevel 4 call DO_1050.BAT REM Call 1050 and ....run BBS
if errorlevel 4 goto BBS
if errorlevel 3 goto BBS REM Nothing happens...run BBS
if errorlevel 2 call DO_LD.BAT REM Call Special LD boards
if errorlevel 2 goto BBS REM Nothing happens...run BBS
if errorlevel 1 goto BBS REM Nothing happens...run BBS
if errorlevel 1 goto BBS REM Nothing happens...run BBS
if errorlevel 0 goto BBS REM Nothing happens...run BBS
goto START
REM Since this is just an example file, I got lazy and duplicated the
REM WeekEND label under the WeekDay label. Generally you would want
REM to allow more LD calls on weekends and at different times than
REM on weekdays. You could also have more special events which did
REM maintainance and so forth.
:EXT_EVT
if exist EXT_EVT.FLG call EEVENT.BAT REM Assumed name of EXTERNAL EVENT BAT
goto BBS
REM If the Flag does not exist it runs the BBS; if it exists it runs the
REM external event. The Flag is to prevent the event from running more than
REM once.
:BBS
REM This is the label that runs your BBS...
echo Loading WWIV now !
bbs /A1 /N0 /O REM This can also be bbs -A1 -N0 -O
if exist bbs_err.txt goto QUIT
if errorlevel 1 echo BBS error>bbs_err.txt
if errorlevel 0 goto START
REM The errorlevel of 1 is forced by /A1...bbs gives an errorlevel of 1
REM on an abnormal exit. It gives an errorlevel of 0 if everything is ok
:QUIT
REM End of batch file. Normally this would only be reached if bbs exits
REM twice with an abnormal errorlevel. Assumption is that if something is
REM wrong and it is repeated, you want to quit and shut down.
echo BBS Shut Down
echo .
echo .
echo An abnormal exit error occurred twice. Please investigate !
echo .
echo .
echo .
echo S Y S O P A L E R T
echo .
REM Think it will get your attention to find the echoed message above on
REM your screen ?
REM Questions on this setup may be addressed to Filo at the following
REM WWIV based addresses:
REM 1 @5252 WWIVnet, WWIVlink, IceNET, FireNET
REM 1:397/5252 FidoNet
REM dd-ii.UUCP UseNet