Skip to content

Latest commit

 

History

History
113 lines (81 loc) · 2.81 KB

README.md

File metadata and controls

113 lines (81 loc) · 2.81 KB

tasker

Build Status LFE Versions Erlang Versions Tags

Project Logo

An LFE application for running recurring tasks

Table of Contents

About

The tasker tool simply takes configuration that describes one or more OS CLI calls and executes them reguarly at the configured interval. Task metadata takes the following form:

[{name, String},
 {cmd, String},
 {args, [term] | []},
 {interval, Integer}
]

And a complete configiration takes the form:

[{tasker,
  [{tasks, [metadata, ...]}]
}].

See ./priv/examples for working configs.

Build

Note that, due to the use of the safer timer:apply_repeatedly, this project requires Erlang 26 or later.

$ rebar3 lfe compile

Start the Project REPL

$ rebar3 lfe repl

Tests

$ rebar3 as test lfe test

Usage

Run the date example, calling out to the system shell every 5 seconds to get the system date:

erl -noshell -pa $(rebar3 path) \
  -config priv/examples/shell-date.config \
  -run tasker start

Run the example that configures multiple recurring tasks:

erl -noshell -pa $(rebar3 path) \
  -config priv/examples/multiple.config \
  -run tasker start

For convenience, a shell script has been added that allows one to run a config like so:

./bin/tasker priv/examples/multiple.config

An alternative that executes the call as a background OS process:

./bin/taskerd priv/examples/multiple.config

License

Apache License, Version 2.0

Copyright © 2023, Duncan McGreggor [email protected].