X-Git-Url: http://git.annexia.org/?p=whenjobs.git;a=blobdiff_plain;f=tools%2Fwhenjobs.pod;h=43fe847a8a743c7eebfcf2e0760d4612f28931ad;hp=2acec9f96c554b262e77a8f65c14fce0399e4b0b;hb=438813bcf327729f9dafc1a56c6cede550435e2e;hpb=2177768e4fe92533adc6ef76098312750576dc49 diff --git a/tools/whenjobs.pod b/tools/whenjobs.pod index 2acec9f..43fe847 100644 --- a/tools/whenjobs.pod +++ b/tools/whenjobs.pod @@ -513,6 +513,37 @@ with C: The job name is passed to the shell script in the C<$JOBNAME> environment variable. +=head2 OCAML EXPRESSIONS + +As well as simple "every" and "when" expressions, advanced users may +want to use arbitrary OCaml expressions, functions, etc in the jobs +script. These are useful for factoring common code or strings, for +setting the initial values of variables, or for defining cleanup +functions. + +A simple example of an OCaml expression is: + + let prefix = "daily_" + + job (prefix ^ "virus_scan") + every day : + << + # ... + >> + + job (prefix ^ "disk_check") + every day : + << + # ... + >> + +which creates two jobs called C<"daily_virus_scan"> and +C<"daily_disk_check"> (C<^> is the OCaml string concatenation +operator). + +The OCaml expressions run once, when the jobs file is being loaded or +reloaded. +