Runs commands automatically.
cron [ -f configurationfile ] [ -Q ]
The cron daemon runs shell commands at specified dates and times. The following event types are scheduled by the cron daemon:
The way these events are handled is specified by the /var/adm/cron/queuedefs file.
Regularly scheduled commands can be specified according to instructions contained in the crontab files. You can submit your crontab file with the crontab command. Use the at command to submit commands that are to be run only once. Because the cron daemon never exits, it should be run only once.
When the TZ environment variable is changed, either with the chtz command, a Web-based System Manager application, or through SMIT, the cron daemon must be restarted. This enables the cron daemon to use the correct time zone and summer time change information for the new TZ environment variable.
The cron daemon reads the /etc/cronlog.conf configuration file provided by the user to log the information. If a configuration file has not been created, then the cron daemon creates a log of its activities in the /var/adm/cron/log file. The cron daemon reads the configuration file when it is activated and when it receives the hangup signal.
If the cron daemon is not able to create or open the user-specified logfile, then it creates a log of its activities in the /var/adm/cron/log file.
Item | Description |
---|---|
-f ConfigurationFile | Specifies an alternate configuration file. |
-Q | Quiet mode. If specified, -Q disables the cron logging. This parameter is valid for a user-configured log file as well as the default /var/adm/cron/log file. This option must follow the -f option (if -f is specified). |
Auditing Events
If the auditing subsystem is properly configured and is enabled, the cron daemon generates the following audit record (event) every time the command is run:
Event | Information |
---|---|
CRON_Start | Lists the name of each job, whether the job was initiated by an at or cron command, and the time the job started. |
CRON_Finish | Lists the user's name, process ID of the job, and the time the processing was completed. |
Attention RBAC users and Trusted AIX® users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.
Item | Description |
---|---|
/var/adm/cron/FIFO | A named pipe that sends messages to the cron daemon when new jobs are submitted with the crontab or at commands. |
/var/adm/cron | Specifies the main cron daemon directory. |
/var/adm/cron/log | Default log file which specifies the accounting information for all the executed cron. Contains information like the owner, pid, start time, command, and the exit status of the cron job. Rotation is not performed on this file. |
/etc/cronlog.conf | Specifies the default cron configuration file for logging information. |
/var/adm/cron/queuedefs | Specifies the cron daemon events file. |
/var/spool/cron | Specifies the spool area. |
/usr | Indicates directory kept open by the cron daemon. |
/usr/bin | Indicates directory kept open by the cron daemon. |
/usr/lib | Indicates directory kept open by the cron daemon. |
/etc | Indicates directory kept open by the cron daemon. |
/tmp | Indicates directory kept open by the cron daemon. |
Configuration File
The configuration file informs the cron daemon where and how to log the information. Using the configuration file you can specify logfile names, size limits, rotation policies, compress and archive attributes.
If you do not use the -f flag, the cron daemon reads the default /etc/cronlog.conf configuration file.
If cron fails to open the configuration file, it continues with /var/adm/cron/log.
The cron daemon ignores blank lines and lines beginning with a # (pound sign).