crontab v1.1.3 Crontab.CronExpression

This is the Crontab.CronExpression module / struct.

Summary

Functions

Defines the Cron Interval

Create a %Crontab.CronExpression{} via sigil

Convert Crontab.CronExpression struct to Tuple List

Types

condition()
condition() :: {interval, [value]}
condition_list()
condition_list() :: [condition]
day()
day() :: 0..31
hour()
hour() :: 0..23
interval()
interval ::
  :second |
  :minute |
  :hour |
  :day |
  :month |
  :weekday |
  :year
min_max()
min_max() :: {:-, time_unit, time_unit}
minute()
minute() :: 0..59
month()
month() :: 1..12
t()
t() :: %Crontab.CronExpression{day: [value], extended: boolean, hour: [value], minute: [value], month: [value], reboot: boolean, second: [value], weekday: [value], year: [value]}
time_unit()
value()
value ::
  time_unit |
  :* |
  :L |
  {:L, value} |
  {:/, time_unit | :* | min_max, pos_integer} |
  min_max |
  {:W, time_unit | :L}
weekday()
weekday() :: 0..7
year()
year() :: integer

Functions

__struct__()

Defines the Cron Interval

* * * * * * *
| | | | | | |
| | | | | | +-- :year Year                 (range: 1900-3000)
| | | | | +---- :weekday Day of the Week   (range: 1-7, 1 standing for Monday)
| | | | +------ :month Month of the Year   (range: 1-12)
| | | +-------- :day Day of the Month      (range: 1-31)
| | +---------- :hour Hour                 (range: 0-23)
| +------------ :minute Minute             (range: 0-59)
+-------------- :second Second             (range: 0-59)

The :extended attribute defines if the second is taken into account.

sigil_e(cron_expression, options)
sigil_e(binary, charlist) :: t

Create a %Crontab.CronExpression{} via sigil.

Examples

iex> ~e[*]
%Crontab.CronExpression{
  extended: false,
  second: [:*],
  minute: [:*],
  hour: [:*],
  day: [:*],
  month: [:*],
  weekday: [:*],
  year: [:*]}

iex> ~e[*]e
%Crontab.CronExpression{
  extended: true,
  second: [:*],
  minute: [:*],
  hour: [:*],
  day: [:*],
  month: [:*],
  weekday: [:*],
  year: [:*]}

iex> ~e[1 2 3 4 5 6 7]e
%Crontab.CronExpression{
  extended: true,
  second: [1],
  minute: [2],
  hour: [3],
  day: [4],
  month: [5],
  weekday: [6],
  year: [7]}
to_condition_list(interval)
to_condition_list(t) :: condition_list

Convert Crontab.CronExpression struct to Tuple List

Examples

iex> Crontab.CronExpression.to_condition_list %Crontab.CronExpression{
...> minute: [1], hour: [2], day: [3], month: [4], weekday: [5], year: [6]}
[ {:minute, [1]},
  {:hour, [2]},
  {:day, [3]},
  {:month, [4]},
  {:weekday, [5]},
  {:year, [6]}]

iex> Crontab.CronExpression.to_condition_list %Crontab.CronExpression{
...> extended: true, second: [0], minute: [1], hour: [2], day: [3], month: [4], weekday: [5], year: [6]}
[ {:second, [0]},
  {:minute, [1]},
  {:hour, [2]},
  {:day, [3]},
  {:month, [4]},
  {:weekday, [5]},
  {:year, [6]}]