Linux: cron job launches E-Mail but .esmtp_queue gets permission denied

Linux: cron job launches E-Mail but .esmtp_queue gets permission denied

by 06S01at14163 itservice -
Number of replies: 1

For developing courses on this machine only I install the latest moodle (3.4 as of November 2017).

No problem with that.


As advised there is a cron job under /etc/cron.d The long time between launches is acceptable this not a production server.

24 */6 * * * apache /var/www/html/moodle-pckurse/admin/cli/cron.php > /dev/null


Which is launched on time.

Before I added 'sending output to nirvana' there was a message in /var/messages


mkdir: cannot create directory ‘/usr/share/httpd/.esmtp_queue’: Permission denied
unable to create queue dir /usr/share/httpd/.esmtp_queue


The reason why the message is logged is obvious as for security there is SELinux on the fedora box and the httpd-directories are owned by root.


So just to know what would the E-Mail tell me other than the running of the cron job?  The job ran and terminated successfully as logged in the cron.log


The other way round. Is there a way to provided a setting that these E-Mails should be delivered to an other linux user.


Some information to understand this minor discomfort would be appreciated.


ra.be.baerlin

Average of ratings: -
In reply to 06S01at14163 itservice

Re: Linux: cron job launches E-Mail but .esmtp_queue gets permission denied

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

When you run a command using the crontab any output is emailed to the user running the job, in your case apache.

According to the man page for crontab, you can send this to a different user by including a line above the existing entry setting MAILTO to the user you want to receive the email, e.g.

MAILTO=fred
24 */6 * * * apache /var/www/html/moodle-pckurse/admin/cli/cron.php > /dev/null

This would send the email to local user fred instead (assuming the user exists).