package crontab

  1. Overview
  2. Docs
Interacting with cron from OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

0.1.tar.gz
md5=0bea4f8de63112ad92706e985e431ed0
sha512=a7a4a4f70625bd8222bd2f66dee524e54634d3a5915cab140c114228d02b0e7c598bd7675c584a05c240fbf92070c2d198fb4a1b92631eb83c333fd3e58c080b

doc/crontab/Cron/index.html

Module CronSource

Cron is a task scheduler standardized by POSIX.

Sourcetype t

The type for cron table.

Sourcetype entry

The type of cron table entry.

Sourceval entries : t -> entry list

entries crontab observes crontab entries.

Sourceval make : entry list -> t

make entries builds a contrab from a list of entries.

Sourcetype field =
  1. | All
    (*

    All is equivalent to "*".

    *)
  2. | List of element list
    (*

    Enumerate [1; 3; 9] is equivalent to "1,3,9"

    *)
Sourceand element = private
  1. | Single of int
    (*

    Single k is the singleton value "k".

    *)
  2. | Range of int * int
    (*

    Range (a, b) is the range "a-b".

    *)
Sourcetype validator = int -> unit

Not all integers are valid. A validator makes sure only valid values are used.

Sourceval valid_minute : validator

A minute is valid if in 0..59.

Sourceval valid_hour : validator

An hour is valid if in 0..23.

Sourceval valid_day_of_the_month : validator

A day of the month is valid if in 1.31.

Sourceval valid_day_of_the_week : validator

A day of the week is valid if in 0..6.

Sourceval valid_month_of_the_year : validator

A month of the year is valid if in 1..12.

Sourceval single : validator -> int -> element

Build a single valid element.

Sourceval range : validator -> int -> int -> element

Build a range of valid elements.

Sourceexception InvalidElement of string * int
Sourceval make_entry : ?minute:field -> ?hour:field -> ?day_of_the_month:field -> ?month_of_the_year:field -> ?day_of_the_week:field -> string -> entry

make_entry command creates a crontab entry executing command.

  • parameter minute

    must be in 0..59.

  • parameter hour

    must be in 0..23.

  • parameter day_of_the_month

    must be in 1.31.

  • parameter month_of_the_year

    must be in 1..12.

  • parameter day_of_the_week

    must be in 0..6 with 0 = Sunday.

  • raises InvalidEntryField

    if some input does not conform to the previous constraint. For all field, the default value is All.

Sourceval minute : entry -> field

minute entry returns an integer in 0..59. None means Any.

Sourceval hour : entry -> field

hour entry returns an integer in 0..23. None means Any.

Sourceval day_of_the_month : entry -> field

day_of_the_month entry returns an integer in 1..31. None means Any.

Sourceval month_of_the_year : entry -> field

month_of_the_year entry returns an integer in 0..11. None means Any.

Sourceval day_of_the_week : entry -> field

day_of_the_week entry returns an integer in 0..6. None means Any.

Sourceexception ParseError of int * string
Sourceval entry_of_string : string -> entry

entry_of_string line turns a crontab line into an entry.

  • raises ParseError

    if line does not conform to POSIX.

Sourceval string_of_entry : entry -> string

string_of_entry entry produces a textual representation of entry conforming to the POSIX standard.

  • raises ParseError

    if line does not conform to POSIX.

Sourceval crontab_of_string : string -> t

crontab_of_string input reads input as a crontab is possible.

Sourceval string_of_crontab : t -> string

string_of_crontab crontable produces a textual representation of crontable conforming to the POSIX standard.

Sourceexception CrontabError of Unix.process_status
Sourceval crontab_install : ?user:string -> t -> unit

crontab_install crontable installs the crontable.

  • parameter user

    is the current user by default.

Sourceval crontab_get : ?user:string -> unit -> t

crontab_list () returns the currently installed cron table.

  • parameter user

    is the current user by default.

Sourceval crontab_insert_entry : ?user:string -> entry -> unit

crontab_insert_entry entry installs a new entry in the current crontab, if it is not already there.

Sourceval crontab_remove_entry : ?user:string -> entry -> unit

crontab_remove_entry entry removes an entry in the current crontab.

Sourceval crontab_remove : ?user:string -> unit -> unit

crontab_remove () removes the currently installed cron table.

  • parameter user

    is the current user by default.

Sourceval version : string

This library version.

OCaml

Innovation. Community. Security.