免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2635 | 回复: 5
打印 上一主题 下一主题

设置corn通知邮件,不生效的原因 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-03-10 21:32 |只看该作者 |倒序浏览
请教各位大侠:

[root@myhost1 log]# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=testHOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
You have new mail in /var/spool/mail/root
[root@myhost1 log]#
[root@myhost1 log]# /etc/init.d/crond restart
Stopping crond:                                            [  OK  ]
Starting crond:                                            [  OK  ]
[root@myhost1 log]#

测试 test用户可以正常接收root账号的邮件

/var/log/cron

Jan 27 06:39:40 myhost1 anacron[1921]: Job `cron.weekly' terminated
Jan 27 06:39:40 myhost1 anacron[1921]: Job `cron.monthly' started
Jan 27 06:39:40 myhost1 anacron[1921]: Job `cron.monthly' terminated
Jan 27 06:39:40 myhost1 anacron[1921]: Normal exit (3 jobs run)
Jan 27 06:40:01 myhost1 crond[2291]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:41:01 myhost1 crond[2303]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:42:01 myhost1 crond[2343]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:43:01 myhost1 crond[2355]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:44:01 myhost1 crond[2367]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:45:01 myhost1 crond[2378]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:46:01 myhost1 crond[2390]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:47:01 myhost1 crond[2401]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:48:01 myhost1 crond[2413]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:49:01 myhost1 crond[2425]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:50:01 myhost1 crond[2436]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:51:01 myhost1 crond[2448]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:52:01 myhost1 crond[2459]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:53:01 myhost1 crond[2471]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:54:01 myhost1 crond[2483]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:55:01 myhost1 crond[2523]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:56:01 myhost1 crond[2535]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:57:01 myhost1 crond[2546]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:58:01 myhost1 crond[2558]: (root) CMD (/bin/mail -s "this is success" tina)
Jan 27 06:59:01 myhost1 crond[2570]: (root) CMD (/bin/mail -s "this is success" tina)

有STDOUT的也有STDERROR的,但是test用户都无法接收到通知邮件,系统会把邮件发送到root
U2685 root@myhost1.org      Thu Jan 27 17:07  24/856   "Cron <root@myhost1> /bin/test -s "this is success" tina1"
U2686 root@myhost1.org      Thu Jan 27 17:07  24/843   "Cron <root@myhost1> /bin/mail -s "this is success" tina"
U2687 root@myhost1.org      Thu Jan 27 17:10  24/856   "Cron <root@myhost1> /bin/test -s "this is success" tina1"
U2688 root@myhost1.org      Thu Jan 27 17:10  24/843   "Cron <root@myhost1> /bin/mail -s "this is success" tina"
U2689 root@myhost1.org      Thu Jan 27 17:11  24/856   "Cron <root@myhost1> /bin/test -s "this is success" tina1"
U2690 root@myhost1.org      Thu Jan 27 17:12  24/856   "Cron <root@myhost1> /bin/test -s "this is success" tina1"
U2691 root@myhost1.org      Thu Jan 27 17:12  24/843   "Cron <root@myhost1> /bin/mail -s "this is success" tina"
U2692 root@myhost1.org      Thu Jan 27 17:13  24/856   "Cron <root@myhost1> /bin/test -s "this is success" tina1"
U2693 root@myhost1.org      Thu Jan 27 17:13  24/843   "Cron <root@myhost1> /bin/mail -s "this is success" tina"
U2694 root@myhost1.org      Thu Jan 27 17:14  24/856   "Cron <root@myhost1> /bin/test -s "this is success" tina1"
U2695 root@myhost1.org      Thu Jan 27 17:14  24/843   "Cron <root@myhost1> /bin/mail -s "this is success" tina"
U2696 root@myhost1.org      Thu Jan 27 17:15  24/856   "Cron <root@myhost1> /bin/test -s "this is success" tina1"
>N2697 root@myhost1.org      Thu Jan 27 17:15  23/833   "Cron <root@myhost1> /bin/mail -s "this is success" tina"
N2698 root@myhost1.org      Thu Jan 27 17:16  23/846   "Cron <root@myhost1> /bin/test -s "this is success" tina1"
N2699 root@myhost1.org      Thu Jan 27 17:16  23/833   "Cron <root@myhost1> /bin/mail -s "this is success" tina"
N2700 root@myhost1.org      Thu Jan 27 17:17  23/846   "Cron <root@myhost1> /bin/test -s "this is success" tina1"
N2701 root@myhost1.org      Thu Jan 27 17:17  23/833   "Cron <root@myhost1> /bin/mail -s "this is success" tina"
N2702 root@myhost1.org      Thu Jan 27 17:18  23/846   "Cron <root@myhost1> /bin/test -s "this is success" tina1"
N2703 root@myhost1.org      Thu Jan 27 17:18  23/833   "Cron <root@myhost1> /bin/mail -s "this is success" tina"
N2704 root@myhost1.org      Thu Jan 27 17:19  23/846   "Cron <root@myhost1> /bin/test -s "this is success" tina1"
N2705 root@myhost1.org      Thu Jan 27 17:19  23/833   "Cron <root@myhost1> /bin/mail -s "this is success" tina"
N2706 root@myhost1.org      Thu Jan 27 17:20  23/846   "Cron <root@myhost1> /bin/test -s "this is success" tina1"

/var/log/maillog没有test账号的通信记录


请教各位大侠,往下我该如何进行调查呢

论坛徽章:
0
2 [报告]
发表于 2011-03-10 21:48 |只看该作者
回复 1# qmailer


    test@。。。。    写完整呢?

    或做个alias

论坛徽章:
0
3 [报告]
发表于 2011-03-10 21:55 |只看该作者
本帖最后由 qmailer 于 2011-03-10 22:02 编辑

感谢回复,测试过了,写完整也不行

如何做alias??

论坛徽章:
9
2015亚冠之阿尔纳斯尔
日期:2015-09-10 16:21:162015亚冠之塔什干火车头
日期:2015-07-01 16:23:022015年亚洲杯之巴勒斯坦
日期:2015-04-20 17:19:46子鼠
日期:2014-11-13 09:51:26未羊
日期:2014-08-28 18:13:36技术图书徽章
日期:2014-02-21 09:30:15酉鸡
日期:2014-01-14 11:12:49天蝎座
日期:2013-12-09 17:56:53平安夜徽章
日期:2015-12-26 00:06:30
4 [报告]
发表于 2011-03-11 09:56 |只看该作者
回复 3# qmailer


  修改 /etc/aliases

论坛徽章:
0
5 [报告]
发表于 2011-03-22 18:31 |只看该作者
为什么修改这个文件? 如何修改?

论坛徽章:
0
6 [报告]
发表于 2011-03-22 18:44 |只看该作者
回复 5# qmailer


    root: ***@ .com
  
    里面加是为了邮件转发给别的帐户
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP