<?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>猫言猫语 &#187; crontab</title>
	<atom:link href="http://imcat.in/tag/crontab/feed/" rel="self" type="application/rss+xml" />
	<link>http://imcat.in</link>
	<description>人的头脑太复杂,时间过得久,有时候连自己也被自己骗了,记下来才是最真实的……</description>
	<lastBuildDate>Fri, 21 Oct 2011 17:55:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>CentOS安装crontab及使用方法</title>
		<link>http://imcat.in/centos-installation-use-crontab/</link>
		<comments>http://imcat.in/centos-installation-use-crontab/#comments</comments>
		<pubDate>Wed, 26 May 2010 13:09:55 +0000</pubDate>
		<dc:creator>Cat.</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[crontab]]></category>

		<guid isPermaLink="false">http://imcat.in/?p=1289</guid>
		<description><![CDATA[安装crontab: yum install crontabs 说明： /sbin/service crond start //启动服务 /sbin/service crond stop //关闭服务 /sbin/service crond restart //重启服务 /sbin/service crond reload //重新载入配置 查看crontab服务状态：service crond status 手动启动crontab服务：service crond start 查看crontab服务是否已设置为开机启动，执行命令：ntsysv 加入开机自动启动: chkconfig --level 35 crond on 1，crontab命令 功能说明：设置计时器。 语　　法：crontab [-u ][配置文件] 或 crontab [-u ][-elr] 补充说明：cron是一个常驻服务，它提供计时器的功能，让用户在特定的时间得以执行预设的指令或程序。只要用户会编辑计时器的配置文件，就可以使 用计时器的功能。其配置文件格式如下： Minute Hour Day Month DayOFWeek Command 参　　数： -e 　编辑该用户的计时器设置。 -l [...]]]></description>
			<content:encoded><![CDATA[<p>安装crontab:<br />
yum install crontabs</p>
<p>说明：<br />
/sbin/service crond start //启动服务<br />
/sbin/service crond stop //关闭服务<br />
/sbin/service crond restart //重启服务<br />
/sbin/service crond reload //重新载入配置</p>
<p>查看crontab服务状态：service crond status</p>
<p>手动启动crontab服务：service crond start</p>
<p>查看crontab服务是否已设置为开机启动，执行命令：ntsysv</p>
<p>加入开机自动启动:<br />
chkconfig --level 35 crond on<br />
<span id="more-1289"></span></p>
<p>1，crontab命令</p>
<p>功能说明：设置计时器。</p>
<p>语　　法：crontab [-u <用户名称>][配置文件] 或 crontab [-u <用户名称>][-elr]</p>
<p>补充说明：cron是一个常驻服务，它提供计时器的功能，让用户在特定的时间得以执行预设的指令或程序。只要用户会编辑计时器的配置文件，就可以使 用计时器的功能。其配置文件格式如下：<br />
Minute Hour Day Month DayOFWeek Command</p>
<p>参　　数：<br />
-e 　编辑该用户的计时器设置。<br />
-l 　列出该用户的计时器设置。<br />
-r 　删除该用户的计时器设置。<br />
-u<用户名称> 　指定要设定计时器的用户名称。</p>
<p>2，crontab 格式</p>
<p>基本格式 :<br />
*   *　 *　 *　 *　　command<br />
分　时　日　月　周　 命令</p>
<p>第1列表示分钟1～59 每分钟用*或者 */1表示<br />
第2列表示小时1～23（0表示0点）<br />
第3列表示日期1～31<br />
第4列 表示月份1～12<br />
第5列标识号星期0～6（0表示星期天）<br />
第6列要运行的命令</p>
<p>crontab文件的一些例子：</p>
<p>30 21 * * * /usr/local/etc/rc.d/lighttpd restart<br />
上面的例子表示每晚的21:30重启 apache。</p>
<p>45 4 1,10,22 * * /usr/local/etc/rc.d/lighttpd restart<br />
上面的例子表示每月1、 10、22日的4 : 45重启apache。</p>
<p>10 1 * * 6,0 /usr/local/etc/rc.d/lighttpd restart<br />
上面的例子表示每周六、周日的1 : 10重启apache。</p>
<p>0,30 18-23 * * * /usr/local/etc/rc.d/lighttpd restart<br />
上面的例子表示在每天18 : 00至23 : 00之间每隔30分钟重启apache。</p>
<p>0 23 * * 6 /usr/local/etc/rc.d/lighttpd restart<br />
上面的例子表示每星期六的11 : 00 pm重启apache。</p>
<p>* */1 * * * /usr/local/etc/rc.d/lighttpd restart<br />
每一小时重启apache</p>
<p>* 23-7/1 * * * /usr/local/etc/rc.d/lighttpd restart<br />
晚上11点到早上7点之间，每 隔一小时重启apache</p>
<p>0 11 4 * mon-wed /usr/local/etc/rc.d/lighttpd restart<br />
每月的4号与每周一到周三 的11点重启apache</p>
<p>0 4 1 jan * /usr/local/etc/rc.d/lighttpd restart<br />
一月一号的4点重启apache</p>
<p>*/30 * * * * /usr/sbin/ntpdate 210.72.145.44<br />
每半小时同步一下时间</p>
<h2  class="related_post_title">暧味日志</h2><ul class="related_post"><li><a href="http://imcat.in/centos-add-ip-addresses/" title="centos下添加多个IP地址的方法">centos下添加多个IP地址的方法</a> (0)</li><li><a href="http://imcat.in/centos-install-pptpd-vpn-services/" title="CentOS 安装pptpd VPN服务">CentOS 安装pptpd VPN服务</a> (7)</li><li><a href="http://imcat.in/linux-system-install-7-zip-centos/" title="在Linux系统centos 上安装7-ZIP">在Linux系统centos 上安装7-ZIP</a> (11)</li><li><a href="http://imcat.in/linux-system-install-rar-centos/" title="在Linux系统centos上安装RAR">在Linux系统centos上安装RAR</a> (4)</li><li><a href="http://imcat.in/let-crontab-not-to-issue-any-warning-messages/" title="让crontab不再发出告警邮件">让crontab不再发出告警邮件</a> (5)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://imcat.in/centos-installation-use-crontab/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>让crontab不再发出告警邮件</title>
		<link>http://imcat.in/let-crontab-not-to-issue-any-warning-messages/</link>
		<comments>http://imcat.in/let-crontab-not-to-issue-any-warning-messages/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 13:40:23 +0000</pubDate>
		<dc:creator>Cat.</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[crontab]]></category>

		<guid isPermaLink="false">http://imcat.in/%e8%ae%a9crontab%e4%b8%8d%e5%86%8d%e5%8f%91%e5%87%ba%e5%91%8a%e8%ad%a6%e9%82%ae%e4%bb%b6/</guid>
		<description><![CDATA[一直用自动备份mysql数据库并发送到Email , 但cron程序默认设置是,每执行一次命令就会给本地用户发送一次邮件，这个是很烦人的!!!!所以我要禁掉它，解决方法有如下一些： 1.将执行命令的信息重定向到 cron_command &#62;/dev/null 2&#62;&#38;1 2.将执行命令的信息重定向到 cron_command &#38;&#62;/dev/null 3.在crontab设置文件中指定发送到得邮件 MAILTO="" cron_command 暧味日志Linux命令tar压缩排除指定目录的方法 (0)iptables限制同一IP连接数 (3)Linux下替换文件名中的空格 (0)linux修改ssh端口和禁止root远程登陆设置 (5)使用WinSCP连接到Linux (3)]]></description>
			<content:encoded><![CDATA[<p>一直用<a title="Permanent Link to 自动备份mysql数据库并发送到Email" rel="bookmark" href="http://imcat.in/backup-mysql-databases-automatically-sent-to-email/">自动备份mysql数据库并发送到Email</a> , 但cron程序默认设置是,每执行一次命令就会给本地用户发送一次邮件，这个是很烦人的!!!!所以我要禁掉它，解决方法有如下一些：</p>
<blockquote><p>1.将执行命令的信息重定向到<br />
cron_command &gt;/dev/null 2&gt;&amp;1</p>
<p>2.将执行命令的信息重定向到<br />
cron_command &amp;&gt;/dev/null</p>
<p>3.在crontab设置文件中指定发送到得邮件<br />
MAILTO=""<br />
cron_command</p></blockquote>
<h2  class="related_post_title">暧味日志</h2><ul class="related_post"><li><a href="http://imcat.in/linux-tar-exclude/" title="Linux命令tar压缩排除指定目录的方法">Linux命令tar压缩排除指定目录的方法</a> (0)</li><li><a href="http://imcat.in/iptables-limit-number-connections-same-ip/" title="iptables限制同一IP连接数">iptables限制同一IP连接数</a> (3)</li><li><a href="http://imcat.in/linux-replace-the-file-name-space/" title="Linux下替换文件名中的空格">Linux下替换文件名中的空格</a> (0)</li><li><a href="http://imcat.in/linux-change-root-ssh-remote-login-port-and-set-against/" title="linux修改ssh端口和禁止root远程登陆设置">linux修改ssh端口和禁止root远程登陆设置</a> (5)</li><li><a href="http://imcat.in/use-winscp-connect-linux/" title="使用WinSCP连接到Linux">使用WinSCP连接到Linux</a> (3)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://imcat.in/let-crontab-not-to-issue-any-warning-messages/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

