Overview
Occasionally, you may receive an email notifying you of a Cron Daemon failure or error. This will generally have the subject of the email as:
Subject: Cron <root@yourservername>
While the error may be confusing, not all of them are necessarily bad or indicate an issue. The general rule of thumb is that it’s only an issue if the same error occurs two days in a row or more.
Common Causes
Log Rotation failure
This may occur with the /etc/cron.daily/logrotate application. For example:
/etc/cron.daily/logrotate:
error: Compressing program wrote following message to stderr when compressing log /var/log/mariadb/mariadb.log-20210809:
gzip: stdin: file size changed while zipping
This simply indicates that the log file being rotated at the time was also being written to which can occur if other tasks are also occurring at the same time.
Except if it occurs more than 2 days in a row, this can be ignored.
Session cleanup failure
This may occur with the /etc/cron.hourly/systemd-session-cleanup script. For example:
/etc/cron.hourly/systemd-session-cleanup:
Failed to list units: Connection timed out
On rare occasions or where the VPS is under heavy load, it may fail to list all of the current sessions.
Except if it occurs more than 3-4 times in a row, this can be ignored.
Maldet Update
On some of our systems, we run an auxiliary malware detection engine known as maldet. On rare occasions, the overnight update may fail and produce an error. This may look like:
Cron <root@ws1> [ ! -f /etc/cron.hourly/0anacron ] && run-parts /etc/cron.daily
/etc/cron.daily/maldet:
/etc/cron.daily/maldet: line 69: [: ==: unary operator expected
or:
/etc/cron.daily/maldet:
/etc/cron.daily/maldet: line 28: ype: command not found
/etc/cron.daily/maldet: line 29: syntax error near unexpected token `fi'
/etc/cron.daily/maldet: line 29: ` fi'
Except if it occurs more than 2 days in a row, this can be ignored.
Website Specific Cron
The subject will generally have the website username in it rather than root, for example:
Subject: Cron <webuser@servername> /usr/bin/php -f 'httpdocs/cron/cron.php' > /dev/null
The name of the script may vary, however these are generally application specific cron tasks and therefore up to your development team to diagnose further.