Ubuntu: Cron job log reads 'No MTA installed', does that prevent the CRON job from finishing?


I have a cron job that is just running rsync on a particular directory.

When I run the rsync command itself sudo rsync -av --delete /directory1 /directory2, it runs without issue and does exactly as intended.

When the Cron job runs - I see it in /var/log/syslog.1 and it says this (summarized):

Mar  12 11:38:01 ip-xx-xx-xx-xxx CRON[4970]: (root) CMD (rsync --delete /my/directory /backup/directory)  Mar  12 11:38:01 ip-xx-xx-xx-xxx CRON[4970]: (CRON) info (No MTA installed, discarding output)  

But the files are not in the backup directory (so it's not completing).

Does that second statement about 'No MTA installed' prevent the completion of the cron job? What is the best way to get that cron job to complete and get rid of the MTA error?

I found this answer but it doesn't say if that prevents the job from finishing.


No, it does not prevent the CRON job from finishing.

Normally, you shouldn't let your CRON job generate output without telling it where to write it. If you do, like in this case, CRON tries to mail it somewhere (also specified in the crontab file). If it doesn't succeed, it discards the output, as it says in the log file, and goes on.

In your case, you don't have a "Message Transfer Agent" installed. This is a generic name for packages, like postfix and ssmtp, that provide a mail command.

I recommend redirecting SYSOUT and SYSERR from the rsync command using > and 2>, respectively. If you're not interested at all, redirect output to /dev/null.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »