In addition to the individual user crontab files specified by ISO POSIX (2003) stored under /var/spool/cron, the process that executes scheduled commands shall also process the following additional crontab files: /etc/crontab, /etc/cron.d/*. The installation of a package shall not modify the configuration file /etc/crontab.
If a package wishes to install a job that has to be executed periodically, it shall place an executable cron script in one of the following directories:
As these directory names suggest, the files within them are executed on a hourly, daily, weekly, or monthly basis, respectively, under the control of an entry in one of the system crontab files, at an unspecified time of day. See below for the rules concerning the names of cron scripts.
Note: It is recommended that cron scripts installed in any of these directories be script files rather than compiled binaries so that they may be modified by the local system administrator. Conforming applications may only install cron scripts which use an interpreter required by this specification or provided by this or another conforming application.
This specification does not define the concept of a package upgrade. Implementations may do different things when packages are upgraded, including not replacing a cron script if it marked as a configuration file, particularly if the cron script appears to have been modified since installation. In some circumstances, the cron script may not be removed when the package is uninstalled. Applications should design their installation procedure and cron scripts to be robust in the face of such behavior. In particular, cron scripts should not fail obscurely if run in unexpected circumstances. Testing for the existence of application binaries before executing them is suggested.
If a certain task has to be executed at other than the predefined frequencies, the package shall install a file /etc/cron.d/cron-name. The file shall have the same format as that described for the crontab command in ISO POSIX (2003), except that there shall be an additional field, username, before the name of the command to execute. For completeness, the seven fields shall be:
Day of the month [1,31]
Month of the year [1,12]
Day of the week [0,6] (with 0=Sunday)
command [args ...]
To avoid namespace conflicts in the /etc/cron.* directories, filenames installed by conforming packages in /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly, /etc/cron.monthly, or /etc/cron.d shall come from a managed namespace. These filenames may be assigned using one of the following methods:
Assigned names. Such names must be chosen from the character set [a-z0-9]. In order to avoid conflicts these names shall be reserved through the Linux Assigned Names and Numbers Authority (LANANA). Information about the LANANA may be found at www.lanana.org.
Note: Commonly used names should be reserved in advance; developers for projects are encouraged to reserve names from LANANA, so that each distribution can use the same name, and to avoid conflicts with other projects.
Hierarchical names. Script names in this category take the form: <hier1>-<hier2>-...-<name>, where name is taken from the character set [a-z0-9], and where there may be one or more <hier-n> components. <hier1> may either be an LSB provider name assigned by the LANANA, or it may be owners' DNS name in lower case, with at least one '.'. e.g. "debian.org", "staroffice.sun.com", etc. The LSB provider name assigned by LANANA shall only consist of the ASCII characters [a-z0-9].
Reserved names. Names that begin with the character '_' are reserved for distribution use only. These names should be used for essential system packages only.