为什么 cron 没有将作业输出通过电子邮件发送给我?

为什么 cron 没有将作业输出通过电子邮件发送给我?

这是我的 crontab:

MAILTO=michael
02 11 * * * bash /home/michael/projectname/nightly_tests.sh
* * * * * python /home/michael/projectname/throwaway/hello.py

我的用户名指定正确:

-bash-4.1$ whoami 迈克尔

以下是我每分钟尝试运行的操作:

-bash-4.1$ cat /home/michael/projectname/throwaway/hello.py
print "hello world"

我的邮件文件是空的:

-bash-4.1$ ll /var/mail/michael 
-rw-rw---- 1 michael mail 0 Feb 19 23:04 /var/mail/michael

为什么没有发送邮件?我该如何解决?

我在 CentOS (3.7.5-linode48) 上。

编辑邮件日志显示如下:

-bash-4.1$ sudo tail /var/log/maillog
Apr 13 11:49:01 servername postfix/sendmail[6989]: warning: the Postfix sendmail command must be installed without set-uid root file permissions
Apr 13 11:50:01 servername postfix/sendmail[6996]: warning: the Postfix sendmail command has set-uid root file permissions
Apr 14 11:50:01 servername postfix/sendmail[6996]: warning: or the command is run from a set-uid root process
Apr 13 11:50:01 servername postfix/sendmail[6996]: warning: the Postfix sendmail command must be installed without set-uid root file permissions
Apr 13 11:51:01 servername postfix/sendmail[7003]: warning: the Postfix sendmail command has set-uid root file permissions
Apr 13 11:51:01 servername postfix/sendmail[7003]: warning: or the command is run from a set-uid root process
Apr 13 11:51:01 servername postfix/sendmail[7003]: warning: the Postfix sendmail command must be installed without set-uid root file permissions
Apr 13 11:52:01 servername postfix/sendmail[7008]: warning: the Postfix sendmail command has set-uid root file permissions
Apr 13 11:52:01 servername postfix/sendmail[7008]: warning: or the command is run from a set-uid root process
Apr 13 11:52:01 servername postfix/sendmail[7008]: warning: the Postfix sendmail command must be installed without set-uid root file permissions

现在要去 Google 查找这是什么意思。

答案1

这是 CentOS 中 cron 和 postfix 组合的一个错误。请参阅此错误报告据我所知,目前还没有解决办法,但你可以尝试安装旧版本的 cron,看看是否有帮助。

答案2

我联系了服务器管理员。他是这样说的:

不,情况比这更基本 - 邮件服务器默认不运行。我现在已经打开并启用了它,因此您应该会收到大量刚刚被缓存的电子邮件。

捂脸

相关内容