Skip to content
/ tasker Public

An LFE application for running recurring tasks

License

Notifications You must be signed in to change notification settings

lfeutre/tasker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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].