作者 主題: 如何不要收到Cron的執行通知郵件?  (閱讀 5298 次)

0 會員 與 1 訪客 正在閱讀本文。

denise

  • 憂鬱的高中生
  • ***
  • 文章數: 91
    • 檢視個人資料
如何不要收到Cron的執行通知郵件?
« 於: 2009-06-12 09:52 »
我在 /etc/crontab 設了ntpdate 的自動更新時間,但怎麼還是會收到root的執行通知,請問是哪裡弄錯了嗎?
其它的設法也相同,但都不會收到來信...

代碼: [選擇]
@hourly root /usr/sbin/ntpdate time.stdtime.gov.tw && /sbin/hwclock -w && /etc/init.d/dovecot restart 2>&1>/dev/null

Yamaka

  • 俺是博士!
  • *****
  • 文章數: 4913
    • 檢視個人資料
    • http://www.ecmagic.com
回覆: 如何不要收到Cron的執行通知郵件?
« 回覆 #1 於: 2009-06-12 10:08 »
代碼: [選擇]
@hourly root /usr/sbin/ntpdate time.stdtime.gov.tw && /sbin/hwclock -w && /etc/init.d/dovecot restart 2>&1>/dev/null

題外話~~

為何不將3個指令放進 shell script 指令檔裡再放到 crontab !?  ::)

TyroneYeh

  • 俺是博士!
  • *****
  • 文章數: 2396
  • 性別: 男
    • 檢視個人資料
回覆: 如何不要收到Cron的執行通知郵件?
« 回覆 #2 於: 2009-06-12 10:09 »
其它的設定也有用 && 多指令去執行嗎?
--
TyroneYeh

netman

  • 管理員
  • 俺是博士!
  • *****
  • 文章數: 17484
    • 檢視個人資料
    • http://www.study-area.org
回覆: 如何不要收到Cron的執行通知郵件?
« 回覆 #3 於: 2009-06-12 12:13 »
try this:

@hourly root (/usr/sbin/ntpdate time.stdtime.gov.tw && /sbin/hwclock -w && /etc/init.d/dovecot restart ) &>/dev/null

被騎上班的老

  • 酷!學園 學長們
  • 活潑的大學生
  • ***
  • 文章數: 360
    • 檢視個人資料
回覆: 如何不要收到Cron的執行通知郵件?
« 回覆 #4 於: 2009-08-10 18:52 »
man 5 crontab

引用
If MAILTO is defined (and non-empty), mail is sent to  the  user so  named. If  MAILTO  is defined but empty (MAILTO=""), no mail will be sent.