home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cenvi23.zip
/
CRON.DOC
< prev
next >
Wrap
Text File
|
1995-11-14
|
5KB
|
98 lines
Documentation for CRON.CMM, an implementation of Cron for CEnvi.
- - - INTRODUCTION - - -
CMMCRON is a simplified Cron written in CMM. Like it's Unix Big Brother,
cron is a program that you leave running all the time. It then runs other
programs at specified times and dates automatically. This version of CMM
Cron will run on any CEnvi interpreter.
- - - CRON.TAB - - -
The most important concept to Cron is it's CRONTAB file. By default, the
CRONTAB file is located in "C:\CRON.TAB" under DOS, OS/2, NT, and Windows.
Under Netware, it is "SYS:\CRON.TAB". If you supply a parameter to Cron, it
takes that to be the alternate filename for your CRONTAB file.
The CRONTAB file tells Cron what to run and when to run it. This file is
an ascii text file, and you can edit it with your favorite text editor. When
you are done, simply save it, and Cron will notice that you changed it. You
do not have to restart Cron or do any mucking around.
Here is an example CRON.TAB file:
-------------------------------------------------------------------------------
# Example CRON.TAB file.
# As a pointless example, we print the current date and time to the Cron
# screen every ten minutes. However, we do not do it on Mondays. (Mondays
# suck and we don't want to be reminded that the whole week is ahead of
# us...)
*/10 * - * 0,2-6 =date.cmm
-------------------------------------------------------------------------------
Blank lines and lines beginning with the '#' character are ignored. You can
put any comments here you like. All other lines are job entries. This example
has a single job entry, the last line.
The entry consists of six fields, separated by spaces. The 6th field can have
spaces within it. If you want, you can put extra white space at the beginning
of the line. The first five fields tell cron when to run this entry. The fields
in order are: MINUTE HOUR DAY OF MONTH MONTH DAY OF WEEK
Each field can take an integer value from 0 to the last legal value, except DAY
OF MONTH, which starts at 1. Sunday is considered the 0th value for DAY OF WEEK.
For the MONTH and DAY OF WEEK fields, you can use a 3-letter abbreviation
instead. For example, TUE for tuesday, or MAR for March. When the current date
and time is equal to the values set in the fields, the entry is executed.
A special note is in order for the DAY OF MONTH and DAY OF WEEK fields. They
allow you to specify the day to run the program by week or by months. However,
the fields are inclusive: if the current day matches either of the fields,
it will be considered a hit. You may put a '-' in either field to not use it.
You can put a '-' in both fields, but then the entry will never be run.
The values for the fields just described would not provide for a very flexible
way of specifying when to run the entry. With cron, you can extend the basics
in a number of ways. First, you may put a '*' in any field instead of just a
number. In this case, the field will always match. So, if you wanted to run a
program every day at some given time, you could put a '*' in both the MONTH and
DAY OF MONTH fields, and then put some time values in MINUTE and HOUR fields.
Each field can also contain a list of values, such as 1,2,6,7 or MON,WED,SAT.
In this case, the field matches when any of the values is correct. Similarly,
you can include a range of values such as 10-20 or MON-FRI. These two can be
combined as in 1-10,15,20-25. Finally, for a range, you can specify a step
value over that range. An example would be */2, which means all values, but
only take every other one.
Dissecting the example given above (*/10 * - * 0,2-6 =date.cmm), we see that
the program will be run every tenth minute during every hour on every month
on days 0 and 2-6 (or Sunday and Tuesday thru Saturday.) We have not used
the DAY OF MONTH field because we want to use the DAY OF WEEK field only.
Thus, the program will be run every tenth minute every day except on Mondays.
So, you know how to specify when your entry is to be run. The last field tells
Cron what to run. This field encompasses everything after the five time/date
fields. You specify the name of the program you wish to run followed by
any arguments. Cron will search your path for the program, but it is wise
to specify the full path. Also, you should specify the file's extension, since
Cron uses it to try to make sure the program is launched correctly.
By default, the program is run asynchronously; that is Cron starts the program
running, then goes back to its job of waiting. However, if you preceed the
program's name with an '=', Cron will run your program synchronously and
display its output in the Cron window. Using this feature is not recommended,
but at times it may be useful. Because Cron is designed to be portable, the
screen manipulations are basic and running programs on Cron's screen can
really mess up your display.