The crontab is used to schedule commands to be executed periodically on the Zimbra servers.
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 | Description |
---|---|
minute |
0 through 59 |
hour |
0 through 23 |
day of the (month) |
1 through 31 |
month |
1 through 12 |
day of the (week) |
0 through 7 (0 or 7 is Sunday, 1 is Monday, etc., or use names) |
command |
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".
You can view the {product-abbrev} crontab by logging on as zimbra and typing
crontab -l
.
The following cron jobs are scheduled to run for {product-abbrev}:
The log pruning deletes logs from /opt/zimbra/log
that are over eight
days old. The job runs at 2:30 a.m.
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.
Status logging job runs every 2 minutes.
Full and increment backups are scheduled to run according to the schedule
defined by zmschedulebackup
command. By default the full backup is
scheduled for 1:00 a.m., every Saturday. The incremental backups are
scheduled for 1:00 a.m., Sunday through Friday.
By default, backups older then a month are deleted on the first of each month at 12 a.m.
The log pruning deletes logs from /opt/zimbra/mailboxd/logs
that are over
eight days old. The job runs at 2:30 a.m.
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.
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
SQL query optimizer picks the correct indexes when executing SQL
statements. This script is run 1:30 a.m. on Sunday.
zmdbintegrityreport
is run weekly to check the SQL 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 {product-abbrev} 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 {product-abbrev} upgrades.
zmlogprocess
runs every 10 minutes to parse logs and produce MTA
metrics (as/av, volume, count, etc).
The zmqueue
report status via the syslog is reviewed. This is logger
data. The status is updated every 10 minutes.
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. This job should run only on one
Zimbra MTA. The job runs at 11:00 p.m.
zmtrainsa
empties the spam and ham mailboxes each day. The job runs at
11:45 p.m.
Spam bayes auto-expiry maintains the SpamAssassin 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.
crontab -l
# ZIMBRASTART -- DO NOT EDIT ANYTHING BETWEEN THIS LINE AND ZIMBRAEND # # Log pruning # 30 2 * * * find /opt/zimbra/log/ -type f -name *.log* -mtime +8 -exec rm {} \; > /dev/null 2>&1 35 2 * * * find /opt/zimbra/log/ -type f -name *.out.???????????? -mtime +8 -exec rm {} \; > /dev/null 2>&1 # # Status logging # */2 * * * * /opt/zimbra/libexec/zmstatuslog # # Backups # # BACKUP BEGIN # BACKUP END # # crontab.ldap # # # # crontab.store # # Log pruning # 30 2 * * * find /opt/zimbra/mailboxd/logs/ -type f -name \*log\* -mtime +8 -exec rm {} \; > /dev/null 2>&1 30 2 * * * find /opt/zimbra/log/ -type f -name stacktrace.\* -mtime +8 -exec rm {} \; > /dev/null 2>&1 # # Table maintenance # 30 1 * * 7 /opt/zimbra/libexec/zmmaintaintables >> /dev/null 2>&1 # # # Report on any database inconsistencies # 0 23 * * 7 /opt/zimbra/libexec/zmdbintegrityreport -m # # Monitor for multiple mysqld to prevent corruption */5 * * * * /opt/zimbra/libexec/zmcheckduplicatemysqld -e > /dev/null 2>&1 # # crontab.logger # # process logs # 00,10,20,30,40,50 * * * * /opt/zimbra/libexec/zmlogprocess > /tmp/logprocess.out 2>&1 # # Graph generation # 10 * * * * /opt/zimbra/libexec/zmgengraphs >> /tmp/gengraphs.out 2>&1 # # Daily reports 10 1 * * * /opt/zimbra/libexec/zmdailyreport -m # # crontab.mta # # # Queue logging # 0,10,20,30,40,50 * * * * /opt/zimbra/libexec/zmqueuelog # # Spam training 0 23 * * * /opt/zimbra/bin/zmtrainsa >> /opt/zimbra/log/spamtrain.log 2>&1 # # Spam training cleanup # 45 23 * * * /opt/zimbra/bin/zmtrainsa --cleanup >> /opt/zimbra/log/spamtrain.log 2>&1 # # Dspam cleanup # 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/dspam_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/dspam/bin/dspam_logrotate -a 60 -l /opt/zimbra/data/dspam/data/z/i/zimbra/zimbra.log # # Spam Bayes auto-expiry # 20 23 * * * /opt/zimbra/libexec/sa-learn -p /opt/zimbra/conf/salocal.cf --dbpath /opt/zimbra/data/amavisd/.spamassassin --siteconfigpath /opt/zimbra/conf/spamassassin --force-expire --sync > /dev/null 2>&1 # # Clean up amavisd/tmp # 15 5,20 * * * find /opt/zimbra/data/amavisd/tmp -maxdepth 1 -type d -name 'amavis-*' -mtime +1 -exec rm -rf {} \; > /dev/null 2>&1 # # Clean up the quarantine dir # 0 1 * * * find /opt/zimbra/data/amavisd/quarantine -type f -mtime +7 -exec rm -f {} \; > /dev/null 2>&1 ZIMBRAEND -- DO NOT EDIT ANYTHING BETWEEN THIS LINE AND ZIMBRASTART