Real Time eXecutives, Inc.
DOS Scheduling on a Weekly/Monthly/Yearly Basis
This document describes a means to allow a batch file to tell if it should be run on a certain date or day, or month. This allows the batch file to be run by the RTX Schedule program on a daily basis, and only perform some type of useful purpose as required (weekly, monthly etc).
In order to perform this type of scheduling, the RTX Schedule.exe program and the RTX Elevel.com program are required, as well as some knowledge of DOS batch programming techniques.
The RTX Schedule.exe program has a maximum frequency of 24 hours. It cannot schedule any programs on a less frequent basis. The SCHEDULE.DAT configuration file for the RTX Schedule.exe program, must therefore contain an entry to run a batch file every 24 hours, and this batch file will use the RTX Elevel.com program to check the day or date, in order to decide whether or not it should just exit without doing anything, or if it should run some USEFUL.exe program.
1) show the day of the week.
The following example shows how the RTX Elevel.com program can be used to check the day of the week.
2) show the date/time on the 5th day of each month
The following example shows how the RTX Elevel.com program can be used to check for a particular date in the month.
a "Merry Xmas" message
The following example shows how the RTX Elevel.com program can be used to check for a particular month.
Format of the SCHEDULE.DAT file
The ASCII text file SCHEDULE.DAT is the file that the user will create or edit to define the execution times and command lines to be executed by the scheduler program. This file can be created or edited using any ASCII text editor (ie. Brief, PMATE, EDLIN etc.) and can reside either in the current directory or in the DOS path. The schedule table is built from this file on initial execution of the program scheduler or by issuing the "/REBUILD" command (see below).
There are three fields in each record (text line), separated from each other by one or more spaces. The first field is the time of day (since midnight last night) of the first or initial execution of the command line. The second field is the time interval between executions and the third field is the command line to be executed.
The general format is: START_TIME INTERVAL COMMAND_LINE_TO_BE_EXECUTED Times are specified as 1 -to- 3 integers separated by colons, in 24 hour format.
The first integer read will be considered the hours, the second the minutes and the third the seconds. It is not necessary to enter all three integers. For example, if the desired start time is 11 PM, the user can simple enter 23. If the interval time was ten minutes, the user could enter 00:10. If the start time was 1 AM plus 10 seconds the user would have to enter 1:00:10.
The hour field can be greater than 24. For example, if the desired execution interval is every 2 days, the user would enter a 48 for the time interval.
If the execution interval time is zero, the command line will be executed once and only once at the start time specified. If the start time is specified greater than the current time, the command line will be executed once only at that time. If the start time is less than the current time, the command line will be executed once only at the specified start time + 24 hours.
After a "run once only" command has been executed, its entry will be removed from the schedule table. It will not be removed from the SCHEDULE.DAT file. The command line can be re-scheduled by re-executing the schedule program or by re-building the schedule table using the "/REBUILD" command.
If the first character in a schedule definition record is anything other than an ASCII digit (0 -9), the entry will be considered a comment and ignored. This will allow for the inclusion of comments in the schedule definition file. The exception to this rule is the reserved word "NOW". If "NOW" is entered for a start time, the command will be executed at program load (or any time the schedule table is rebuilt). Examples of comment entries and the "NOW" execution, can be seen below in the definition file entry examples.
ELEVEL.com : is a batch process utility program. It is designed to give you greater power from the batch environment, through the use of functions specified in the program command line. Each function returns a value to the batch environment errorlevel parameter.