home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 201.lha / DCron_v1.05 / dcron.doc < prev    next >
Text File  |  1988-12-27  |  5KB  |  140 lines

  1.  
  2.                 DCRON.DOC
  3.  
  4.                   UNIX-like CRON
  5.  
  6.                   V1.05
  7.                  22 December 1988
  8.  
  9.                   Matthew Dillon
  10.                   891 Regal Rd
  11.                   Berkeley, Ca. 94708
  12.  
  13.                  dillon@ucbvax.Berkeley.edu
  14.                  ...!ucbvax!dillon
  15.  
  16. DESCRIPTION:
  17.  
  18.     Those not familar with the UNIX cron command probably do not need it.
  19.  
  20.  
  21. INSTALLATION:
  22.     the NULL: device must be mounted
  23.     an s:crontab file (see instructions below)
  24.     1.3 RUN required so you can: run <nil: >nil: dcron <logfile>
  25.  
  26.     copy null-handler l:
  27.     join devs:Mountlist Mountlist as temp
  28.     copy temp devs:Mountlist
  29.     delete temp
  30.     copy dcron c:        (or wherever)
  31.     copy crontab s:        (modify to your like)
  32.  
  33. INSTRUCTIONS:
  34.  
  35.  
  36.     NOTE:   * All cron-commands are automatically RUN  in the background,
  37.           you do not need to say 'run' in the command argument of the
  38.           s:crontab file
  39.  
  40.         * You do not have to redirect standard command output.  I.E.
  41.           if you do a 'List' from cron, the output is sent to the
  42.           cia.
  43.  
  44.         * DCRON WORKS ONLY WITH 1.3, specifically, the 1.3 RUN command
  45.           must be installed.
  46.  
  47.         * DO NOT RUNBACK CRON!!!  Use: run <nil: >nil:
  48.  
  49.  
  50.     Inspired by Rick Schaeffer's AmigaCron.  I decided to write this
  51. one from scratch.  The program is crontab file compatible with Rick's
  52. and the UNIX cron tab format with the same exceptions as Rick had.
  53. Specifically, the % char is not implemented and the day-of-week is
  54. ranged 0-6 (Sun-Sat) rather than the UNIX 1-7 (Mon-Sun).
  55.  
  56.     The major purpose of this program, apart from yielding the functionality
  57. of cron, is the addition of major time optimizations.  The program does
  58. not scan the S:crontab file every 60 seconds if it doesn't need to.  It
  59. *does* check certain things every 60 seconds like whether the system time
  60. has undergone a drastic change or the s:crontab file has been modified
  61. (yielding a re-scan).  Under normal operation, the program will sleep via
  62. the timer.device for up to an hour between re-scans.  It does this by
  63. calculating the delta time to the next required program execution and
  64. sleeping to just before that time occurs.
  65.  
  66.     The result is that my cron takes virtually no CPU.
  67.  
  68.     My version also fixes several continuity bugs in Rick's (sorry Rick!).
  69. Specifically, commands will never be accidently run twice in a single
  70. minute period and unless the system time is modified, no command will
  71. ever be skipped (due to the cron program missing that particular minute).
  72.  
  73.     [run <nil: >nil:] DCron [-d] logfile
  74.  
  75.     Using the 1.3 RUN command and redirecting both stdin and stdout to NIL:,
  76.     you can safely close the CLI window that you ran DCron in.
  77.  
  78.     The logfile is a required argument and logs all errors and status
  79. messages.  Under normal conditions this file does not get very big.
  80. Cron does an open-append/write/close sequence every time it logs a message
  81. allowing you to cat, edit, or even remove the file with cron running.
  82. (If you remove it, the next logged message will cause the file to be
  83. re-created).
  84.  
  85.     The -d option, for debug, is used for debugging and logs additional
  86. information.
  87.  
  88.     The control file is S:CRONTAB and may contain one of three types of
  89. lines:    (1) A blank line, (2) A line beginning with a hash ``#'' which
  90. introduces a comment, (3) A cron line of 5 or 6 fields:
  91.  
  92. <min> <hour> <day> <month> <dayofweek>    [<command>]
  93.  
  94.     Each field <min> to <dayofweek> can be either a single asterix ``*''
  95. which matches all times, or a comma delimited list of numbers or ranges
  96. which must be in numerical order.  Assume the control file is scanned
  97. every minute.  On every minute, each field that matches the current
  98. time, day, and day of week will be executed.
  99.  
  100.     The <command> field is optional.  If no command is given the date is
  101. simply logged to the logfile (as well as the cron line that caused it).
  102. If a command is given, it is a CLI command and is automatically RUN
  103. (asynchronous from the cron task).  Standard in/out is NIL:  The cron line
  104. that ran the command is logged.
  105.  
  106. * * * * *   Date
  107.  
  108.     Would execute the Date command every minute.  The output is ignored.
  109.     I.E. useless.  Also, running something every minute wastes CPU.
  110.  
  111. 0-3,5,7,40-50 * * * *    Date
  112.  
  113.     Would execute it at the hour, 1 past, 2 past, 3 past, 5 past, 7 past,
  114.     40 41 42 ... and 50 past every hour.  Combinations can be used to
  115.     yield more interesting results:
  116.  
  117. 0 0,12 * * 0    Date
  118.  
  119.     Would run Date at midnight and 12 noon, but only on sunday.
  120.  
  121. 0 0 25 12 *    Echo >ram:x "Merry Cristmas"
  122.  
  123.     Would execute the Echo command at midnight beginning christmas day and
  124.     stick it in ram:x.
  125.  
  126. * * * * 2-3 Date
  127.  
  128.     Is useless ... execute the Date command every minute but only if the
  129.     day is a tuesday or wednesday (i.e. 1440 times on tuesday, 1440
  130.     times on wednesday, nothing for any other day).
  131.  
  132. 0 4 * * 1     shell >ram:backups -c "ChangeTaskPri -1;dobackups"
  133.  
  134.     Would run a shell script to do my HD backup at 4:00 A.M. every Monday.
  135. (I have the advantage of having two physical drives and can back one up
  136. to the other without user intervention).  This would also be useful to
  137. backup something to a remote host if you are on a network.
  138.  
  139.  
  140.