(add-task! task schedule)
(add-task! name task schedule)
Add a task to the list of tasks.
name
is a string with the name of the task, this can be used to delete the task, if needed.
if name
is not specified, the fully-qualified name of the function will be used.
task
is a 0-arity function that will be called for its side-effects, its return value will be discarded.
schedule
is a vector that is used to describe the interval at which the task is run and optionally,
a time to start the task.
Usage:
(add-task! "my-task"
#(println "task is running")
[:every 1 :day 5 :hours :3 minutes 1 :second
:starting-at 10 30])
You don't need to specify :days or :hours, even something like this is valid.
[:every 1 :second] ; :starting-at is optional and can be left out.
The singular and plural of the time period is valid. like 1 :day
and 5 :days
.
Add a task to the list of tasks. `name` is a string with the name of the task, this can be used to delete the task, if needed. if `name` is not specified, the fully-qualified name of the function will be used. `task` is a 0-arity function that will be called for its side-effects, its return value will be discarded. `schedule` is a vector that is used to describe the interval at which the task is run and optionally, a time to start the task. Usage: ```clojure (add-task! "my-task" #(println "task is running") [:every 1 :day 5 :hours :3 minutes 1 :second :starting-at 10 30]) ``` You don't need to specify :days or :hours, even something like this is valid. `[:every 1 :second] ; :starting-at is optional and can be left out.` The singular and plural of the time period is valid. like `1 :day` and `5 :days`.
(remove-task! name)
Removes a task from the task list given the name of the task.
Removes a task from the task list given the name of the task.
(run-tasks!)
This function will start the scheduler. Your tasks will be run when they are due.
Note: if your :starting-at
time was before the task runner is called then it will be immediately run.
For e.g if a task has a starting-at at 10 (10 am) and you call this function at 11 am, the task will run immediately.
This function will start the scheduler. Your tasks will be run when they are due. Note: if your `:starting-at` time was before the task runner is called then it will be immediately run. For e.g if a task has a starting-at at 10 (10 am) and you call this function at 11 am, the task will run immediately.
(running?)
Will return true if sisyphus is running, false if not.
Will return true if sisyphus is running, false if not.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close