<?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://guogoul.com/tag/crontab/feed/" rel="self" type="application/rss+xml" />
	<link>http://guogoul.com</link>
	<description></description>
	<lastBuildDate>Fri, 29 Oct 2010 00:24:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>oom-killer 的发现 与 swap分区搭建</title>
		<link>http://guogoul.com/2010/04/28/oom-killer-swap/</link>
		<comments>http://guogoul.com/2010/04/28/oom-killer-swap/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 08:07:38 +0000</pubDate>
		<dc:creator>shanfeng</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[awstats]]></category>
		<category><![CDATA[cacti]]></category>
		<category><![CDATA[crontab]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[swap]]></category>

		<guid isPermaLink="false">http://guogoul.com/?p=257</guid>
		<description><![CDATA[很不幸机器最近1周一台跑了3年多的机器挂了两次.为了过好5/1决定好好检查一下情况,不幸的是到目前为止还是没有确认最终的因素.
1.检查案发时间:通过cacti的记录,发现机器发生不幸发生在0点到2点之间.这个时间段是后台定时任务运行的高发期.
2.判断一:夜间机器后台任务太过集中,机器load太高,机器年久老化导致机器不堪重负
3.措施: 排查所有crontab中的任务,注释了其中有可以有计算压力太大的任务.把nagios的load报警设到5以下.
4.结果: 不幸在第二次发生.
5.查询日志: 发现在案发时间的日志中记录有关 oom-killer (out of memory)的记录.难道是这个做怪?有关oom请移步http://www.dbanotes.net/database/linux_outofmemory_oom_killer.html.  看了一下本机的内存.发现没有swap分区(当年装机的同事为了提高工作效率) . 再次观察cacti中的内存趋势.内存第天基本没有free.  细看一下crotab中的任务.发现每天2点左右确实有一个吃内存的awstats有跑着.
6.措施: 添加swap别让oom-killer 工作了.
7.添加SWAP:
7.1:   设置swap路径及大小:    dd if=/dev/zero of=/var/swap bs=1024 count=8192000  (内存4G,swap习惯设为其2倍)
7.2:  设置交换文件:  mkswap /var/swap
7.3: 启用交换分区: swapon /var/swap
7.4: 开机自挂:    在/etc/fstab中加上这一行  /var/swap swap swap defaults 0 0
8: 先到这儿吧,让他跑几天,查看日志看看问题解决情况,祝自己好运,能睡个好觉
]]></description>
		<wfw:commentRss>http://guogoul.com/2010/04/28/oom-killer-swap/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>ubuntu(linux)下开机自动运行脚本以及定时任务的处理</title>
		<link>http://guogoul.com/2008/05/21/crontab/</link>
		<comments>http://guogoul.com/2008/05/21/crontab/#comments</comments>
		<pubDate>Wed, 21 May 2008 04:55:31 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[crontab]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.guogoul.com/2008/05/21/crontab/</guid>
		<description><![CDATA[1.开机自运行
    简单的处理开机自运行的方法是修改rc.local文件。此文件位于/etc目录下面. 在默认情况下，rc.local是一个空的脚。您只要修改它就可以了。要注意的是，在此文件中运行的命令其依赖的进程是否运行。本人再实验的时候由于想在开机时启动dia.试了好多次都失败。我想可能是界面进程还没有启动。我的实验脚本为
        echo  &#8220;hello. rc.local&#8221; &#62;&#62;home/shanfeng/rc.local 实验成功
    在/etc目录下面还有rc*.d的目录。这些目录里面放在很多/etc/init.d/下面脚本的软链接,操作系统根据不同的运行等级，选择运行其中下的脚本。您也可以修改它们达到开机自运行的目的。
2。定时任务
    介绍一种简单的处理方式
    用cron处理定时任务,首先要保证cron操作已经运行。如果安装了cron 的话。正常情况下cron已经开机自运行了，如果没有运行的话。
    /etc/init.d/cron start
    用crontab来安排定时任务
    crontab [-u user] {-l&#124; -r &#124;  -e}
    [...]]]></description>
		<wfw:commentRss>http://guogoul.com/2008/05/21/crontab/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

