ZCS Administrator's Guide, Open Source Edition 5.0 (Rev 5.0.19 September 2009)
Table of Contents Previous Next Index


Appendix B ZCS Crontab Jobs

Appendix B ZCS Crontab Jobs
The crontab is used to schedule commands to be executed periodically on the Zimbra servers.
How to read the crontab
Each entry in a crontab file consists of six fields, specified in the following order
minute hour day month weekday command
The fields are separated by blank spaces or tabs.
 
        Field
0 through 7 (0 or 7 is Sunday, 1 is Monday, etc., or use names)
This is the complete sequence of commands to be executed for the job
When an asterisk (*) is displayed, it means all possible values for the field. For example, an asterisk in the hour time field would be equivalent to “every hour”
ZCS Cron Jobs
You can view the ZCS crontab by logging on as zimbra and typing crontab -l.
The following cron jobs are scheduled to run for ZCS
Log pruning
The log pruning deletes logs from /opt/zimbra/log that are over eight days old. The job runs at 2:30 a.m.
Status logging
zmstatuslog calls zmcontrol status and outputs it data into syslog.
This is primarily so that logger can read the data and keep the administration
console status up-to-date. zmdisklog inserts the disk utilization of local disks into syslog so that logger can update the administration console.
Status logging job runs every 2 minutes and the disk log runs every 10 minutes.
Jobs for crontab.store
Log pruning
The log pruning deletes logs from /opt/zimbra/mailboxd/logs that are over eight days old. The job runs at 2:30 a.m.
Clean up the quarantine dir
Mail identified with a virus or spam are not dropped immediately, but are put in quarantine. Messages older than seven days are deleted at 1:00 a.m daily.
Table maintenance
The ANALYZE TABLE statement is run on all tables in the database to update the statistics for all indexes. This is done to make sure that the MySQL query optimizer picks the correct es when executing SQL statements. This script is run 1:30 a.m.on Sunday.
Report on any database inconsistencies
zmdbintegrityreport is run weekly to check the MySQL database for corruption and will notify the administrator if any corruption is found. When this is run, it may consume a significant amount of I/O. If you find that it is an issue, you may want to change the frequency with which zmdbintegrityreport is run by editing the ZCS crontab entry. This report runs at 11:00 p.m. Sundays.
Large sites may opt to disable this by setting zmlocalconfig -e zmdbintegrityreport_disabled=TRUE.
If you choose to disable this, it is recommended that the integrity report be run by hand during the normal maintenance windows and prior to running any ZCS upgrades.
Monitor for multiple mysqld tp prevent corruption
A script is executed to see if mysqld process is running to detect cases where corruption is likely to be caused. An email is generated if it finds more than 1 mysqld process running. The script runs every 5 minutes.
Jobs for crontab.logger
process logs
zmlogprocess takes the raw_data in the logger data and aggregates and
summarizes data into mta, amavis, tables. It also prunes old data,
optimizes the database tables and other maintenance tasks for logger db. The logger database data is updated every 10 minutes.
Graph generation
The graphs that display the server performance statistics are updated every 10 minutes.
Daily reports
When the logger package is installed, a daily mail report is automatically scheduled in the crontab. The report runs every morning at 1:10. and is sent to the administrator’s email address.
Jobs for crontab.mta
Queue logging
The zmqueue report status via the syslog is reviewed. This is logger data. The status is updated every 10 minutes.
Spam training
The zmtrainsa script is enabled to feed mail that has been classified as spam or a non-spam to the SpamAssassin application. SpamAssassin learns what signs are likely to mean spam or ham. The job runs at 11:00 p.m.
Spam training cleanup
zmtrainsa empties the spam and ham mailboxes each day. The job runs at 11:45 p.m.
DSPAM cleanup
This job does not run at this time.
Spam Bayes auto-expiry
Spam bayes auto-expiry maintains the spam-assassin Bayes database.
This keeps the database to manageable size ensuring spam processing
remains as quick as possible. This runs every day at 11:20 p.m.
Clean up amavisd/tmp
This job is used to clean up the amavisd temp files. It runs at 5:15 a.m. and at 8:15 p.m.
Single Server Crontab -l Example
 
0 1 * * * [ -d /opt/zimbra/data/dspam/data/z/i/zimbra/zimbra.sig ] && find /opt/ zimbra/dspam/var/dspam/data/z/i/zimbra/zimbra.sig/ -type f -name \*sig -mtime +7 -exec rm {} \; > /dev/null 2>&1
8 4 * * * [ -f /opt/zimbra/data/dspam/system.log ] && /opt/zimbra/dspam/bin/dspa m_logrotate -a 60 -l /opt/zimbra/data/dspam/system.log
8 8 * * * [ -f /opt/zimbra/data/dspam/data/z/i/zimbra/zimbra.log ] && /opt/zimbra a/dspam/bin/dspam_logrotate -a 60 -l /opt/zimbra/data/dspam/data/z/i/zimbra/zimb ra.log
20 23 * * * /opt/zimbra/libexec/sa-learn -p /opt/zimbra/conf/salocal.cf --dbpath /opt/zimbra/data/amavisd/.spamassassin --siteconfigpath /opt/zimbra/conf/spamas sassin --force-expire --sync > /dev/null 2>&1
 

Appendix B ZCS Crontab Jobs

Table of Contents Previous Next Index
ZCS Administrator's Guide, Open Source Edition 5.0 (Rev 5.0.19 September 2009)
Copyright © 2009 Zimbra Inc.