<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>syslog &#8211; 記下來</title>
	<atom:link href="https://noter.tw/tag/syslog/feed/" rel="self" type="application/rss+xml" />
	<link>https://noter.tw</link>
	<description>一路上踩到的坑、遇到的問題，一點一滴記下來，希望能幫助到需要的人~</description>
	<lastBuildDate>Wed, 04 Dec 2019 01:05:50 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.3</generator>

<image>
	<url>https://noter.tw/wp-content/uploads/cropped-old-1130742_1920-1-32x32.jpg</url>
	<title>syslog &#8211; 記下來</title>
	<link>https://noter.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Crontab 取消寄信功能</title>
		<link>https://noter.tw/52/crontab-%e5%8f%96%e6%b6%88%e5%af%84%e4%bf%a1%e5%8a%9f%e8%83%bd/</link>
					<comments>https://noter.tw/52/crontab-%e5%8f%96%e6%b6%88%e5%af%84%e4%bf%a1%e5%8a%9f%e8%83%bd/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Wed, 19 Sep 2018 16:18:05 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[crontab]]></category>
		<category><![CDATA[mailto]]></category>
		<category><![CDATA[syslog]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=52</guid>

					<description><![CDATA[<p>用了那麼久的 Ubuntu，這幾天才知道原來 crontab 執行的時候，會把一些錯誤訊息或是輸出寄發 email，發現這件事純粹是個意外 &#8230; 前幾天 Ubuntu 使用 Ssmtp 透過&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/52/crontab-%e5%8f%96%e6%b6%88%e5%af%84%e4%bf%a1%e5%8a%9f%e8%83%bd/" data-wpel-link="internal">Crontab 取消寄信功能</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>用了那麼久的 Ubuntu，這幾天才知道原來 crontab 執行的時候，會把一些錯誤訊息或是輸出寄發 email，發現這件事純粹是個意外 &#8230; </p>



<span id="more-52"></span>



<p>前幾天 <a rel="noreferrer noopener" href="https://noter.tw/50/ubuntu-%e4%bd%bf%e7%94%a8-ssmtp-%e9%80%8f%e9%81%8e-gmail-%e7%99%bc%e9%80%81-email/" target="_blank" data-wpel-link="internal">Ubuntu 使用 Ssmtp 透過 Gmail 發送 Email</a> 提到小蛙需要寄送登入通知，卻因為 VPS 提供的 IP 在 SPAM 清單中而一直無法成功，所以才找其他方式，使用 ssmtp 透過 Gmail 發送相關通知，在小蛙設定好 ssmtp 送信資料後，小蛙的 Gmail 收到一大堆信 &#8230; </p>



<p>一開始小蛙根本不知道發生什麼事，從信中找蛛絲馬跡，看到標題寫 Cron，跟 /var/log/syslog 裡的文字有點像，於是開始 Google crontab 寄信，結果 &#8230; 小蛙才疏學淺，竟然一直到現在才知道 crontab 會把有輸出執行結果的或是有問題的，發送 email 給 root，現在想想好像的確有這麼一回事，有時使用到一半會看到「您有新的 mail 在 xxxxx」的字樣，瞬間恍然大悟。 </p>



<p>要關掉這功能很簡單，參考 <a rel="noreferrer noopener nofollow external" href="https://www.digitalocean.com/community/questions/stop-the-php5-cron-emails" target="_blank" data-wpel-link="external" class="wpel-icon-right">Stop the php5 cron emails<span class="wpel-icon wpel-image wpel-icon-6"></span></a>，只要在 /etc/crontab 中加入一行設定就可以了。 </p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code">MAILTO=""</pre>



<p>小蛙做了這個設定後，卻還是會收到一個 PHP 執行的錯誤訊息，於是在資料夾中找到 /etc/cron.d/php 也有定期執行的程式，一樣加上「MAILTO=&#8221;&#8221;」，之後，這些訊息就只會輸出在 /var/log/syslog，不會寄發 email 囉！</p>



<p>如果還是有遇到其他的，不妨找找看是不是有漏掉其他 include 進檔案的 crontab 設定喔！</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/52/crontab-%e5%8f%96%e6%b6%88%e5%af%84%e4%bf%a1%e5%8a%9f%e8%83%bd/" data-wpel-link="internal">Crontab 取消寄信功能</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/52/crontab-%e5%8f%96%e6%b6%88%e5%af%84%e4%bf%a1%e5%8a%9f%e8%83%bd/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
