Git Product home page Git Product logo

elcron's Introduction

elcron - A cron emulator for Emacs

Introduction

elcron is an emulator of cron for Emacs. It has functionality to schedule function calls at specific time points, following a cron-like expression.

Configuration

You can call the function elcron-schedule to schedule a function call at specific times. For example, the following function call schedules a message starting with the third second then every five seconds in the 3rd to 10th minute every hour, every day, every month and every year.

(setq elcron-test-timer
      (elcron-schedule "2/5 5-10"
                     (lambda () (message "%s cron fired"
                                         (format-time-string "%T %d/%m/%Y")))))

;; To cancel the elcron timer, simply do
(cancel-timer elcron-test-timer)

A elcron expression can be

  • a cron-like string of up to 7 parts, SECONDS MINUTES HOURS DAY MONTH WEEKDAY YEAR. For example, 0/5 14,18,20-39,52 * * JAN,MAR,SEP MON-FRI 2002-2050.
  • a vector of up to 7 parts. For example [(/ 0 5) (14 18 (- 20 39) 52) * * (jan mar sep) (- mon fri) (- 2002 2050)].
  • a plist. For example (:second (/ 0 5) :minute (14 18 (- 20 39) 52) :month (jan mar sep) :weekday (- mon fri) :year (- 2002 2050)).

For more complicated elcron expressions, see here for the format.

Why?

Mostly because I got interested in efficient ways to compute elcron trigger times given an expression. Let me know if you have better methods.

With that being said, elcron is not meant as a replacement for a system’s cron. For one thing, elcron timers will not survive across Emacs sessions, nor will they run when Emacs is not running. Also, elcron uses Emacs timers which are triggered when Emacs is idle and so accurate triggers at specific times are not guaranteed. The elcron scheduler may even skip some triggers if Emacs is busy for the the whole duration between two or more triggers.

elcron's People

Contributors

haji-ali avatar

Stargazers

Anoduck avatar DarkBuffalo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.