Skip to content

kchrismucheke/excron

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Excron

Codacy Badge

A cron-like library to run jobs in Elixir.

- Easy config
- Tiny and readable
- Cluster support with each job running in only one node

Installation

````elixir
    def deps.do 
    [
        {:excron, [github: "kchrismucheke/excron"]}
    ]
    end
````

Usage

In application.ex, include Ex.Worker in your supervisiton tree

````elixir
    {Excron.Worker, ex_cron_config()}
````

Then write your configuration

  ````elixir
    def ex_cron_config()
    [
        # runs `Foo.Bar.perform/0` every second
        %{cron: "* * * * * *", module: Foo.Bar},
        # runs `Foo.Bar.custom/0` every 5 minutes
        %{cron: "* */5 * * * *", module: Foo.Bar, function: :custom},
        # runs `IO.puts/1` with "hello world" every day at 1:30
        %{cron: "0 30 1 * * *", module: IO, function: :puts, args: ["hello world"]},
    ]
    end
  ````

Please note Cron expressions are evaluated over UTC time..

To Do

- Publish to hexdocs

About

A cron-like library to run jobs in Elixir.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages