On a CentOS server, cronjob did not work. Checking the log file found the following error message in /var/log/cron
Oct 24 18:35:01 CentOS-75-64-minimal crond[1546]: (/usr/local/bin/monitor-mysql) ERROR (getpwnam() failed)
The error was because no user was specified in the cronjob. When you use cronjob in file /etc/crontab, you need to specify the username before the command in cronhjob.
On the server, I had the following cronjob
*/5 * * * * /usr/local/bin/monitor-mysql > /var/log/mysql-monitor.log
To fix the error, I added the user name before the command as below.
*/5 * * * * root /usr/local/bin/monitor-mysql > /var/log/mysql-monitor.log
See cronjob