Merge pull request #114 from WoltLab/mkdocs
[GitHub/WoltLab/woltlab.github.io.git] / docs / package / pip / cronjob.md
1 # Cronjob Package Installation Plugin
2
3 Registers new cronjobs.
4 The cronjob schedular works similar to the `cron(8)` daemon, which might not available to web applications on regular webspaces.
5 The main difference is that WoltLab Suite’s cronjobs do not guarantee execution at the specified points in time:
6 WoltLab Suite’s cronjobs are triggered by regular visitors in an AJAX request, once the next execution point lies in the past.
7
8 ## Components
9
10 Each cronjob is described as an `<cronjob>` element with the mandatory attribute `name`.
11
12 ### `<classname>`
13
14 The name of the class providing the cronjob's behaviour,
15 the class has to implement the `wcf\system\cronjob\ICronjob` interface.
16
17 ### `<description>`
18
19 !!! info "The `language` attribute is optional and should specify the [ISO-639-1](https://en.wikipedia.org/wiki/ISO_639-1) language code."
20
21 Provides a human readable description for the administrator.
22
23 ### `<start*>`
24
25 All of the five `startMinute`, `startHour`, `startDom` (Day Of Month), `startMonth`, `startDow` (Day Of Week) are required.
26 They correspond to the fields in `crontab(5)` of a cron daemon and accept the same syntax.
27
28 ### `<canBeEdited>`
29
30 Controls whether the administrator may edit the fields of the cronjob.
31
32 ### `<canBeDisabled>`
33
34 Controls whether the administrator may disable the cronjob.
35
36 ### `<options>`
37
38 The options element can contain a comma-separated list of options of which at least one needs to be enabled for the template listener to be executed.
39
40 ## Example
41
42 ```xml
43 <?xml version="1.0" encoding="UTF-8"?>
44 <data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/2019/cronjob.xsd">
45 <import>
46 <cronjob name="com.example.package.example">
47 <classname>wcf\system\cronjob\ExampleCronjob</classname>
48 <description>Serves as an example</description>
49 <description language="de">Stellt ein Beispiel dar</description>
50 <startminute>0</startminute>
51 <starthour>2</starthour>
52 <startdom>*/2</startdom>
53 <startmonth>*</startmonth>
54 <startdow>*</startdow>
55 <canbeedited>1</canbeedited>
56 <canbedisabled>1</canbedisabled>
57 </cronjob>
58 </import>
59 </data>
60 ```
61