cl-cron

API Reference

cl-cron

A simple tool that provides cron like facilities directly inside of common lisp. For this to work properly note that your lisp implementation should have support for threads

CL-CRON

  • Variable *CRON-LOAD-FILE*
    nil
    a parameter which points to a lisp or fasl file which would be loaded once start-cron is called. The boot file should be made of as many make-cron-job calls as you like one after the other in normal s-expression fashion.
  • Variable *CRON-LOG-FILE*
    "./cl-cron.log"
    a parameter to set the cron file log location.
  • Function MAKE-CRON-JOB (function-symbol &key (minute :every) (step-min 1) (hour :every) (step-hour 1) (day-of-month :every) (step-dom 1) (month :every) (step-month 1) (day-of-week :every) (step-dow 1) (boot-only nil) (hash-key nil))
    creates a new instance of a cron-job object and appends it to the cron-jobs-list after processing its time. Note that if you wish to use multiple values for each parameter you need to provide a list of numbers or use the gen-list function. You can not have a list of symbols when it comes to month or day-of-week. Please note that as by ANSI Common Lisp for the month variable the possible values are between 1 and 12 inclusive with January=1 and for day of week the possible values are between 0 and 6 with Monday=0. Returns the hash-key
  • Function DELETE-CRON-JOB (cron-key)
    deletes the cron job with the corresponding hash key
  • Function START-CRON
    function that starts cron by first loading the cron file defined in the variable, then it runs any cron-job that has the job-only-at-boot property set to t. Finally, it starts a thread that runs cron-dispatcher
  • Function RESTART-CRON
    function that starts up cron but without loading the file or running any of the boot only cron jobs in the list
  • Function STOP-CRON
    allows the stoppage of cron through the killing of the cron-dispatcher. Note that cron-dispatcher is killed only if it is sleeping otherwise we wait till the cron jobs finish. To reuse cron after calling stop-cron, you would need to recall start-cron which would go through all the steps as if cron has just booted. If you wish to prevent these actions when you restart cron then please you restart-cron.
  • Function GEN-LIST (start-list end-list &optional (increment 1))
    functions that returns a list of numbers starting with start-list and ending with end-list
  • Function MIN-LIST (lst)
    finds the minimum element of a list
  • Function MAX-LIST (lst)
    finds the minimum element of a list
  • Function LOG-CRON-MESSAGE (message &optional (type "error"))
    Simply log the message sent with type as well