home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cenvi23.zip / CRON.DOC < prev    next >
Text File  |  1995-11-14  |  5KB  |  98 lines

  1. Documentation for CRON.CMM, an implementation of Cron for CEnvi.
  2.  
  3.  
  4. - - -  INTRODUCTION  - - -
  5.  
  6.  
  7. CMMCRON is a simplified Cron written in CMM. Like it's Unix Big Brother,
  8. cron is a program that you leave running all the time. It then runs other
  9. programs at specified times and dates automatically. This version of CMM
  10. Cron will run on any CEnvi interpreter.
  11.  
  12.  
  13.  
  14. - - -  CRON.TAB  - - -
  15.  
  16.  
  17. The most important concept to Cron is it's CRONTAB file. By default, the
  18. CRONTAB file is located in "C:\CRON.TAB" under DOS, OS/2, NT, and Windows.
  19. Under Netware, it is "SYS:\CRON.TAB". If you supply a parameter to Cron, it
  20. takes that to be the alternate filename for your CRONTAB file.
  21.  
  22. The CRONTAB file tells Cron what to run and when to run it. This file is
  23. an ascii text file, and you can edit it with your favorite text editor. When
  24. you are done, simply save it, and Cron will notice that you changed it. You
  25. do not have to restart Cron or do any mucking around.
  26.  
  27. Here is an example CRON.TAB file:
  28.  
  29. -------------------------------------------------------------------------------
  30. # Example CRON.TAB file.
  31.  
  32.  
  33. # As a pointless example, we print the current date and time to the Cron
  34. # screen every ten minutes. However, we do not do it on Mondays. (Mondays
  35. # suck and we don't want to be reminded that the whole week is ahead of
  36. # us...)
  37.  
  38. */10 * - * 0,2-6 =date.cmm
  39. -------------------------------------------------------------------------------
  40.  
  41. Blank lines and lines beginning with the '#' character are ignored. You can
  42. put any comments here you like. All other lines are job entries. This example
  43. has a single job entry, the last line.
  44.  
  45. The entry consists of six fields, separated by spaces. The 6th field can have
  46. spaces within it. If you want, you can put extra white space at the beginning
  47. of the line. The first five fields tell cron when to run this entry. The fields
  48. in order are:  MINUTE  HOUR   DAY OF MONTH   MONTH   DAY OF WEEK
  49.  
  50. Each field can take an integer value from 0 to the last legal value, except DAY
  51. OF MONTH, which starts at 1. Sunday is considered the 0th value for DAY OF WEEK.
  52. For the MONTH and DAY OF WEEK fields, you can use a 3-letter abbreviation
  53. instead. For example, TUE for tuesday, or MAR for March. When the current date
  54. and time is equal to the values set in the fields, the entry is executed.
  55.  
  56. A special note is in order for the DAY OF MONTH and DAY OF WEEK fields. They
  57. allow you to specify the day to run the program by week or by months. However,
  58. the fields are inclusive: if the current day matches either of the fields,
  59. it will be considered a hit. You may put a '-' in either field to not use it.
  60. You can put a '-' in both fields, but then the entry will never be run.
  61.  
  62. The values for the fields just described would not provide for a very flexible
  63. way of specifying when to run the entry. With cron, you can extend the basics
  64. in a number of ways. First, you may put a '*' in any field instead of just a
  65. number. In this case, the field will always match. So, if you wanted to run a
  66. program every day at some given time, you could put a '*' in both the MONTH and
  67. DAY OF MONTH fields, and then put some time values in MINUTE and HOUR fields.
  68. Each field can also contain a list of values, such as 1,2,6,7 or MON,WED,SAT.
  69. In this case, the field matches when any of the values is correct. Similarly,
  70. you can include a range of values such as 10-20 or MON-FRI. These two can be
  71. combined as in 1-10,15,20-25. Finally, for a range, you can specify a step
  72. value over that range. An example would be */2, which means all values, but
  73. only take every other one.
  74.  
  75. Dissecting the example given above (*/10 * - * 0,2-6 =date.cmm), we see that
  76. the program will be run every tenth minute during every hour on every month
  77. on days 0 and 2-6 (or Sunday and Tuesday thru Saturday.) We have not used
  78. the DAY OF MONTH field because we want to use the DAY OF WEEK field only.
  79.  
  80. Thus, the program will be run every tenth minute every day except on Mondays.
  81.  
  82.  
  83. So, you know how to specify when your entry is to be run. The last field tells
  84. Cron what to run. This field encompasses everything after the five time/date
  85. fields. You specify the name of the program you wish to run followed by
  86. any arguments. Cron will search your path for the program, but it is wise
  87. to specify the full path. Also, you should specify the file's extension, since
  88. Cron uses it to try to make sure the program is launched correctly.
  89.  
  90. By default, the program is run asynchronously; that is Cron starts the program
  91. running, then goes back to its job of waiting. However, if you preceed the
  92. program's name with an '=', Cron will run your program synchronously and
  93. display its output in the Cron window. Using this feature is not recommended,
  94. but at times it may be useful. Because Cron is designed to be portable, the
  95. screen manipulations are basic and running programs on Cron's screen can
  96. really mess up your display.
  97.  
  98.