<?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>【知行合一】-Poople&#039;s Blog &#187; Linux</title>
	<atom:link href="http://99dev.net/archives/tag/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://99dev.net</link>
	<description>智巧终归庸俗，雄谋只余虚话</description>
	<lastBuildDate>Wed, 12 Oct 2011 01:19:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>关于入侵那点破事</title>
		<link>http://99dev.net/archives/1017</link>
		<comments>http://99dev.net/archives/1017#comments</comments>
		<pubDate>Mon, 11 Apr 2011 07:49:55 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[Web服务器]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/1017</guid>
		<description><![CDATA[愚人节那天，被开了个玩笑，托管在电信机房的某台服务器被取得Web Shell，系统平均负载(Load Average高达100多)。
症状分析
程序漏洞被利用，入侵者上传了sucrack这个多线程root密码破解程序，耗尽系统计算资源
  
<span class="readmore"><a href="http://99dev.net/archives/1017" title="关于入侵那点破事" target="_blank">阅读全文——共1420字</a></span>]]></description>
			<content:encoded><![CDATA[<p>愚人节那天，被开了个玩笑，托管在电信机房的某台服务器被取得Web Shell，系统平均负载(Load Average高达100多)。</p>
<p>症状分析</p>
<p>程序漏洞被利用，入侵者上传了sucrack这个多线程root密码破解程序，耗尽系统计算资源</p>
<p>  <span id="more-1017"></span>
<p>Tasks: 285 total, 115 running, 170 sleeping,&#160;&#160; 0 stopped,&#160;&#160; 0 zombie   <br />Cpu(s): 84.7%us, 12.3%sy,&#160; 0.0%ni,&#160; 0.0%id,&#160; 0.0%wa,&#160; 1.0%hi,&#160; 2.0%si,&#160; 0.0%st    <br />Mem:&#160;&#160; 4148472k total,&#160; 2808280k used,&#160; 1340192k free,&#160;&#160; 199496k buffers    <br />Swap:&#160; 4096532k total,&#160;&#160; 311152k used,&#160; 3785380k free,&#160; 1081584k cached</p>
<p>&#160; PID USER&#160;&#160;&#160;&#160;&#160; PR&#160; NI&#160; VIRT&#160; RES&#160; SHR S %CPU %MEM&#160;&#160;&#160; TIME+&#160; COMMAND   <br /> 2460 apache&#160;&#160;&#160; 25&#160;&#160; 0 1007m 796m&#160; 476 R&#160; 6.6 19.7 549:12.50 sucrack    <br />21856 apache&#160;&#160;&#160; 20&#160;&#160; 0&#160; 9476 4840 2588 S&#160; 5.0&#160; 0.1&#160;&#160; 0:00.15 python    <br />21854 apache&#160;&#160;&#160; 19&#160;&#160; 0&#160; 9476 4820 2568 S&#160; 3.7&#160; 0.1&#160;&#160; 0:00.12 python    <br />21868 apache&#160;&#160;&#160; 19&#160;&#160; 0&#160; 9232 4496 2408 R&#160; 3.7&#160; 0.1&#160;&#160; 0:00.11 python    <br />21870 apache&#160;&#160;&#160; 20&#160;&#160; 0&#160; 8164 4388 2324 R&#160; 3.7&#160; 0.1&#160;&#160; 0:00.11 python    <br />21850 apache&#160;&#160;&#160; 16&#160;&#160; 0&#160; 9480 4824 2568 R&#160; 3.3&#160; 0.1&#160;&#160; 0:00.10 python    <br />21858 apache&#160;&#160;&#160; 15&#160;&#160; 0&#160; 9480 4816 2568 R&#160; 3.3&#160; 0.1&#160;&#160; 0:00.10 python    <br />21860 apache&#160;&#160;&#160; 21&#160;&#160; 0&#160; 8052 4152 2212 R&#160; 3.0&#160; 0.1&#160;&#160; 0:00.09 python    <br />19471 apache&#160;&#160;&#160; 15&#160;&#160; 0&#160; 9480 4824 2568 R&#160; 2.0&#160; 0.1&#160;&#160; 0:04.71 python    <br />20370 apache&#160;&#160;&#160; 15&#160;&#160; 0&#160; 9480 4916 2596 R&#160; 2.0&#160; 0.1&#160;&#160; 0:03.22 python    <br />20633 apache&#160;&#160;&#160; 15&#160;&#160; 0&#160; 9480 4836 2568 R&#160; 2.0&#160; 0.1&#160;&#160; 0:02.70 python    <br />16534 apache&#160;&#160;&#160; 16&#160;&#160; 0&#160; 9480 4824 2568 R&#160; 1.7&#160; 0.1&#160;&#160; 0:09.57 python    <br />16804 apache&#160;&#160;&#160; 15&#160;&#160; 0&#160; 9480 4828 2568 R&#160; 1.7&#160; 0.1&#160;&#160; 0:08.92 python    <br />17061 apache&#160;&#160;&#160; 16&#160;&#160; 0&#160; 9480 4828 2568 R&#160; 1.7&#160; 0.1&#160;&#160; 0:08.36 python    <br />17418 apache&#160;&#160;&#160; 16&#160;&#160; 0&#160; 9480 4916 2596 R&#160; 1.7&#160; 0.1&#160;&#160; 0:08.06 python    <br />17420 apache&#160;&#160;&#160; 15&#160;&#160; 0&#160; 9480 4828 2568 R&#160; 1.7&#160; 0.1&#160;&#160; 0:08.04 python</p>
<p>处理过程：</p>
<p>1.操作系统几近卡死，考虑到该业务系统不重要，直接重启</p>
<p>2.查看access.log的异常记录，关掉受影响站点</p>
<p>以上措施都属于亡羊补牢，等空闲时间，再分析文件权限和日志，把真正的幕后黑手揪出来。</p>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/1017/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux获取程序编译参数</title>
		<link>http://99dev.net/archives/974</link>
		<comments>http://99dev.net/archives/974#comments</comments>
		<pubDate>Thu, 02 Dec 2010 09:23:54 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[其他Linux技术]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://99dev.net/?p=974</guid>
		<description><![CDATA[作为系统管理员，经常会碰到这样一个场景：刚接手应用系统不久，业务扩展迅速，老板要求你再搭建N个应用环境，并希望尽量与运行中的平台一致。
犯难的是，前同事留下的文档不详细，没有关于几个主要Service的编译参数。这时你就必须设法取得信息。
1.通过软件包自己的version参数或者debug工具
例如，MySQL软件包中的mysqlbug，执行该工具，将返回debug信息，过滤出其中的Configure command代码块即可
<span class="readmore"><a href="http://99dev.net/archives/974" title="Linux获取程序编译参数" target="_blank">阅读全文——共2730字</a></span>]]></description>
			<content:encoded><![CDATA[<p>作为系统管理员，经常会碰到这样一个场景：刚接手应用系统不久，业务扩展迅速，老板要求你再搭建N个应用环境，并希望尽量与运行中的平台一致。<br />
犯难的是，前同事留下的文档不详细，没有关于几个主要Service的编译参数。这时你就必须设法取得信息。</p>
<p><strong>1.通过软件包自己的version参数或者debug工具</strong><br />
例如，MySQL软件包中的mysqlbug，执行该工具，将返回debug信息，过滤出其中的Configure command代码块即可<br />
<span id="more-974"></span></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Configure command: .<span style="color: #000000; font-weight: bold;">/</span>configure &nbsp;<span style="color: #ff0000;">'--disable-shared'</span> <span style="color: #ff0000;">'--with-server-suffix=-community'</span> <span style="color: #ff0000;">'--without-plugin-ndbcluster'</span> <span style="color: #ff0000;">'--with-plugin-innobase'</span> <span style="color: #ff0000;">'<br />
--with-plugin-partition'</span> <span style="color: #ff0000;">'--with-plugin-csv'</span> <span style="color: #ff0000;">'--with-plugin-archive'</span> <span style="color: #ff0000;">'--with-plugin-blackhole'</span> <span style="color: #ff0000;">'--with-plugin-federated'</span> <span style="color: #ff0000;">'--without-plugin-da<br />
emon_example'</span> <span style="color: #ff0000;">'--without-plugin-ftexample'</span> <span style="color: #ff0000;">'--without-plugin-example'</span> <span style="color: #ff0000;">'--with-embedded-server'</span> <span style="color: #ff0000;">'--without-bench'</span> <span style="color: #ff0000;">'--with-big-tables'</span> <span style="color: #ff0000;">'--enabl<br />
e-assembler'</span> <span style="color: #ff0000;">'--enable-local-infile'</span> <span style="color: #ff0000;">'--with-mysqld-user=mysql'</span> <span style="color: #ff0000;">'--with-unix-socket-path=/var/lib/mysql/mysql.sock'</span> <span style="color: #ff0000;">'--with-pic'</span> <span style="color: #ff0000;">'--prefix=/'</span><br />
<span style="color: #ff0000;">'--with-extra-charsets=complex'</span> <span style="color: #ff0000;">'--with-ssl'</span> <span style="color: #ff0000;">'--exec-prefix=/usr'</span> <span style="color: #ff0000;">'--libexecdir=/usr/sbin'</span> <span style="color: #ff0000;">'--libdir=/usr/lib'</span> <span style="color: #ff0000;">'--sysconfdir=/etc'</span> <span style="color: #ff0000;">'--datadi<br />
r=/usr/share'</span> <span style="color: #ff0000;">'--localstatedir=/var/lib/mysql'</span> <span style="color: #ff0000;">'--infodir=/usr/share/info'</span> <span style="color: #ff0000;">'--includedir=/usr/include'</span> <span style="color: #ff0000;">'--mandir=/usr/share/man'</span> <span style="color: #ff0000;">'--enable-th<br />
read-safe-client'</span> <span style="color: #ff0000;">'--with-comment=MySQL Community Server (GPL)'</span> <span style="color: #ff0000;">'--with-readline'</span> <span style="color: #ff0000;">'--with-zlib-dir=bundled'</span> <span style="color: #ff0000;">'CC=gcc'</span> <span style="color: #ff0000;">'CFLAGS=-O2 -g -pipe -Wa<br />
ll -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tab<br />
les'</span> <span style="color: #ff0000;">'LDFLAGS='</span> <span style="color: #ff0000;">'CXX=gcc'</span> <span style="color: #ff0000;">'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32<br />
-march=i386 -mtune=generic -fasynchronous-unwind-tables -felide-constructors -fno-exceptions -fno-rtti '</span></div></td></tr></tbody></table></div>
<p>附上其他常用service编译参数的查看方法</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">查看nginx编译参数：nginx <span style="color: #660033;">-V</span><br />
查看apache编译参数：<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>apache<span style="color: #000000; font-weight: bold;">/</span>build<span style="color: #000000; font-weight: bold;">/</span>config.nice<br />
查看mysql编译参数：mysqlbug<br />
查看php编译参数：php <span style="color: #660033;">-i</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> configure</div></td></tr></tbody></table></div>
<p>All Tested OK！</p>
<p><strong>2.利用SRPM包的spec文件获取build信息</strong><br />
以上查看Apache编译的方法，只能service是采用tar.gz安装的环境。如果是rpm安装，利用该方法是行不通的，rpm安装的service，并不会留下config.nice。<br />
解决办法就是搜索该软件是否有发布SRPM(.src.rpm后缀)，将其解压，查看spec文件中的%build代码块。</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">%</span>build<br />
......<br />
..<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">-C</span> \<br />
<span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>_sysconfdir<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000; font-weight: bold;">/</span>httpd \<br />
<span style="color: #660033;">--with-apr</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>apr-config \<br />
<span style="color: #660033;">--with-apr-util</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>apu-config \<br />
<span style="color: #660033;">--exec-prefix</span>=<span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>_prefix<span style="color: #7a0874; font-weight: bold;">&#125;</span> \<br />
<span style="color: #660033;">--bindir</span>=<span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>_bindir<span style="color: #7a0874; font-weight: bold;">&#125;</span> \<br />
<span style="color: #660033;">--sbindir</span>=<span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>_sbindir<span style="color: #7a0874; font-weight: bold;">&#125;</span> \<br />
<span style="color: #660033;">--mandir</span>=<span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>_mandir<span style="color: #7a0874; font-weight: bold;">&#125;</span> \<br />
<span style="color: #660033;">--libdir</span>=<span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>_libdir<span style="color: #7a0874; font-weight: bold;">&#125;</span> \<br />
<span style="color: #660033;">--sysconfdir</span>=<span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>_sysconfdir<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>conf \<br />
<span style="color: #660033;">--includedir</span>=<span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>_includedir<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000; font-weight: bold;">/</span>httpd \<br />
<span style="color: #660033;">--libexecdir</span>=<span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>_libdir<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>modules \<br />
<span style="color: #660033;">--datadir</span>=<span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>contentdir<span style="color: #7a0874; font-weight: bold;">&#125;</span> \<br />
<span style="color: #660033;">--with-mpm</span>=<span style="color: #007800;">$mpm</span> \<br />
<span style="color: #660033;">--enable-suexec</span> <span style="color: #660033;">--with-suexec</span> \<br />
<span style="color: #660033;">--with-suexec-caller</span>=<span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>suexec_caller<span style="color: #7a0874; font-weight: bold;">&#125;</span> \<br />
<span style="color: #660033;">--with-suexec-docroot</span>=<span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>contentdir<span style="color: #7a0874; font-weight: bold;">&#125;</span> \<br />
<span style="color: #660033;">--with-suexec-logfile</span>=<span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>_localstatedir<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>suexec.log \<br />
<span style="color: #660033;">--with-suexec-bin</span>=<span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>_sbindir<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000; font-weight: bold;">/</span>suexec \<br />
<span style="color: #660033;">--with-suexec-uidmin</span>=<span style="color: #000000;">500</span> <span style="color: #660033;">--with-suexec-gidmin</span>=<span style="color: #000000;">500</span> \<br />
<span style="color: #660033;">--with-devrandom</span> \<br />
<span style="color: #660033;">--with-ldap</span> <span style="color: #660033;">--enable-ldap</span> <span style="color: #660033;">--enable-auth-ldap</span> \<br />
<span style="color: #660033;">--enable-cache</span> <span style="color: #660033;">--enable-disk-cache</span> <span style="color: #660033;">--enable-mem-cache</span> <span style="color: #660033;">--enable-file-cache</span> \<br />
<span style="color: #660033;">--enable-ssl</span> <span style="color: #660033;">--with-ssl</span> \<br />
<span style="color: #660033;">--enable-deflate</span> <span style="color: #660033;">--enable-cgid</span> \<br />
<span style="color: #660033;">--enable-proxy</span> <span style="color: #660033;">--enable-proxy-connect</span> \<br />
<span style="color: #660033;">--enable-proxy-http</span> <span style="color: #660033;">--enable-proxy-ftp</span> \</div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/974/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>释放僵死的Apach进程</title>
		<link>http://99dev.net/archives/971</link>
		<comments>http://99dev.net/archives/971#comments</comments>
		<pubDate>Tue, 30 Nov 2010 09:39:13 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[Web服务器]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://99dev.net/?p=971</guid>
		<description><![CDATA[服务器某次故障，重启httpd出现如下错误提示
123456# /etc/init.d/httpd restart
Stopping httpd: &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#91; &#160;OK &#160;&#93;
Starting httpd: &#40;98&#41;Address already in use: make_sock: could not bind to address &#91;::&#93;:80
<span class="readmore"><a href="http://99dev.net/archives/971" title="释放僵死的Apach进程" target="_blank">阅读全文——共421字</a></span>]]></description>
			<content:encoded><![CDATA[<p>服务器某次故障，重启httpd出现如下错误提示</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># /etc/init.d/httpd restart</span><br />
Stopping httpd: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">&#91;</span> &nbsp;OK &nbsp;<span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
Starting httpd: <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">98</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>Address already <span style="color: #000000; font-weight: bold;">in</span> use: make_sock: could not <span style="color: #7a0874; font-weight: bold;">bind</span> to address <span style="color: #7a0874; font-weight: bold;">&#91;</span>::<span style="color: #7a0874; font-weight: bold;">&#93;</span>:<span style="color: #000000;">80</span><br />
<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">98</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>Address already <span style="color: #000000; font-weight: bold;">in</span> use: make_sock: could not <span style="color: #7a0874; font-weight: bold;">bind</span> to address 0.0.0.0:<span style="color: #000000;">80</span><br />
no listening sockets available, shutting down<br />
Unable to open logs</div></td></tr></tbody></table></div>
<p><span id="more-971"></span><br />
利用fuser揪出占用该端口的进程ID，并kill掉</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">fuser</span> <span style="color: #660033;">-k</span> <span style="color: #660033;">-n</span> tcp <span style="color: #000000;">80</span></div></td></tr></tbody></table></div>
<p>发送apache启动信号</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>httpd <span style="color: #660033;">-k</span> start</div></td></tr></tbody></table></div>
<p>参考资料</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">fuser命令详解 &nbsp; http://www.91linux.com/html/article/cmd/20080818/13235.html</div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/971/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Server时间校对 &#8211; 优雅式</title>
		<link>http://99dev.net/archives/871</link>
		<comments>http://99dev.net/archives/871#comments</comments>
		<pubDate>Thu, 15 Jul 2010 08:36:58 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[MySQL数据库]]></category>
		<category><![CDATA[系统架构]]></category>
		<category><![CDATA[网络管理]]></category>
		<category><![CDATA[databse]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/871</guid>
		<description><![CDATA[在《解决Linux Server时间不准确的问题》一文中，使用了crontab定期执行ntpdate来校对时间。之后恰巧某博客上的文章，提出一个观点“时钟的跃变，有时候会导致很严重的问题。许多应用程序依赖连续的时钟——毕竟，这是一项常见的假定，即，取得的时间是线性的，一些操作，例如数据库事务， 通常会地依赖这样的事实：时间不会往回跳跃。”时间的瞬变，对于crontab等对时间敏感的系统任务，也是很容易造成错乱的。

优雅的解决方案是，在机器刚开机时，执行ntpupdate直接修改系统时间，然后启动ntpd守护进程，渐进式逼近地调整系统时间，基本可以做到分毫不差。
误差小的时候，ntpd不会直接修改系统时间的，只是对时钟频率进行校正。这种方式好处是系统时间不会有跳变，不会影响像crontab这样程序的运行，缺点是校正需要一定的时间。
<span class="readmore"><a href="http://99dev.net/archives/871" title="Linux Server时间校对 &#8211; 优雅式" target="_blank">阅读全文——共585字</a></span>]]></description>
			<content:encoded><![CDATA[<p>在《解决Linux Server时间不准确的问题》一文中，使用了crontab定期执行ntpdate来校对时间。之后恰巧某博客上的文章，提出一个观点“时钟的跃变，有时候会导致很严重的问题。许多应用程序依赖连续的时钟——毕竟，这是一项常见的假定，即，取得的时间是线性的，一些操作，例如数据库事务， 通常会地依赖这样的事实：时间不会往回跳跃。”时间的瞬变，对于crontab等对时间敏感的系统任务，也是很容易造成错乱的。<br />
<span id="more-871"></span><br />
优雅的解决方案是，在机器刚开机时，执行ntpupdate直接修改系统时间，然后启动ntpd守护进程，渐进式逼近地调整系统时间，基本可以做到分毫不差。</p>
<p>误差小的时候，ntpd不会直接修改系统时间的，只是对时钟频率进行校正。这种方式好处是系统时间不会有跳变，不会影响像crontab这样程序的运行，缺点是校正需要一定的时间。</p>
<p>RHEL系统上，我们常用ntpd来完成该任务；而在Ubuntu系统里，我们则用openntpd来替代它。相对ntpd，openntpd是轻量级的网络时间协议，设置比较简单。<br />
关于ntpd和openntpd的设置，参考以下2篇文章</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">NTP 時間伺服器 &nbsp; &nbsp; http://linux.vbird.org/linux_server/0440ntp.php<br />
设定 OpenNTPD &nbsp; &nbsp; http://wiki.debian.org.hk/w/Setup_OpenNTPD</div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/871/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux时间校对-起手式</title>
		<link>http://99dev.net/archives/870</link>
		<comments>http://99dev.net/archives/870#comments</comments>
		<pubDate>Tue, 13 Jul 2010 11:29:56 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[网络管理]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/870</guid>
		<description><![CDATA[服务器每隔好几个月，总会差那么几分钟。应对措施，就是每隔段时间，进行网络对时。
以下摘自《鸟哥的私房菜》，可解读为什么会有偏差的问题。
1234567事實上，在我們的身邊就有很多的原子鐘，例如石英表，還有電腦主機上面的 BIOS 內部就含有一個原子鐘在
紀錄與計算時間的進行吶！不過由於原子鐘主要是利用計算晶片 (crystal) 的原子震盪週期去計時的，
<span class="readmore"><a href="http://99dev.net/archives/870" title="Linux时间校对-起手式" target="_blank">阅读全文——共1921字</a></span>]]></description>
			<content:encoded><![CDATA[<p>服务器每隔好几个月，总会差那么几分钟。应对措施，就是每隔段时间，进行网络对时。</p>
<p>以下摘自《鸟哥的私房菜》，可解读为什么会有偏差的问题。</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">事實上，在我們的身邊就有很多的原子鐘，例如石英表，還有電腦主機上面的 BIOS 內部就含有一個原子鐘在<br />
紀錄與計算時間的進行吶！不過由於原子鐘主要是利用計算晶片 (crystal) 的原子震盪週期去計時的，<br />
這是因為每種晶片都有自己的獨特的震盪週期之故。 然而因為這種晶片的震盪週期在不同的晶片之間多多少少都會有點差異性,<br />
甚至同一批晶片也可能會或多或少有些許的差異(就連溫度也可能造成這樣的誤差呢！)，<br />
因此也就造成了BIOS的時間會三不五時的給他快了幾秒或者慢了幾秒。<br />
或許您會認為，BIOS 計時器每天快個五秒也沒有什麼了不起的，不過如果您再仔細的算一算，會發現，一天快五秒， 那麼一個月快2.5分鐘，<br />
一年就快了 75 分鐘了！所以說，呵呵！時間差是真的會存在的！ （依据该原理，只要关机或者重启次数越多，时间就会差得越离谱）</div></td></tr></tbody></table></div>
<p>1.挑选最快最稳定的ntp上层服务器</p>
<div class="codecolorer-container dos default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="dos codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">C:\Documents and Settings\linqp<span style="color: #33cc33;">&gt;</span>ping ntp.api.bz -n 100<br />
Approximate round trip times <a href="http://www.ss64.com/nt/in.html"><span style="color: #00b100; font-weight: bold;">in</span></a> milli-seconds:<br />
Minimum = 67ms, Maximum = 89ms, Average = 80ms<br />
<br />
C:\Documents and Settings\linqp<span style="color: #33cc33;">&gt;</span>ping t3.hshh.org -n 50<br />
Approximate round trip times <a href="http://www.ss64.com/nt/in.html"><span style="color: #00b100; font-weight: bold;">in</span></a> milli-seconds:<br />
Minimum = 18ms, Maximum = 22ms, Average = 19ms<br />
<br />
C:\Documents and Settings\linqp<span style="color: #33cc33;">&gt;</span>ping t1.hshh.org -n 50<br />
Approximate round trip times <a href="http://www.ss64.com/nt/in.html"><span style="color: #00b100; font-weight: bold;">in</span></a> milli-seconds:<br />
Minimum = 22ms, Maximum = 27ms, Average = 24ms<br />
<br />
C:\Documents and Settings\linqp<span style="color: #33cc33;">&gt;</span>ping 1.cn.pool.ntp.org -n 50<br />
Ping statistics <a href="http://www.ss64.com/nt/for.html"><span style="color: #00b100; font-weight: bold;">for</span></a> 122.226.192.4:<br />
Packets: Sent = 50, Received = 50, Lost = 0 <span style="color: #33cc33;">(</span>0<span style="color: #33cc33;">%</span> loss<span style="color: #33cc33;">)</span>,<br />
Approximate round trip times <a href="http://www.ss64.com/nt/in.html"><span style="color: #00b100; font-weight: bold;">in</span></a> milli-seconds:<br />
Minimum = 18ms, Maximum = 24ms, Average = 21ms</div></td></tr></tbody></table></div>
<p>2.使用ntpdate同步系统时间</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">root@krc:~# </span><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>ntpdate t3.hshh.org</div></td></tr></tbody></table></div>
<p>修改前</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">root@krc:~# </span><span style="color: #c20cb9; font-weight: bold;">date</span><br />
Tue Jul <span style="color: #000000;">13</span> <span style="color: #000000;">16</span>:<span style="color: #000000;">22</span>:<span style="color: #000000;">42</span> CST <span style="color: #000000;">2010</span><br />
<span style="color: #666666;">root@krc:~# </span>hwclock <span style="color: #660033;">-r</span><br />
Tue <span style="color: #000000;">13</span> Jul <span style="color: #000000;">2010</span> 04:<span style="color: #000000;">21</span>:<span style="color: #000000;">23</span> PM CST -<span style="color: #000000;">0.001126</span> seconds</div></td></tr></tbody></table></div>
<p>修改后</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">root@krc:~# </span><span style="color: #c20cb9; font-weight: bold;">date</span><br />
Tue Jul <span style="color: #000000;">13</span> <span style="color: #000000;">16</span>:<span style="color: #000000;">26</span>:<span style="color: #000000;">33</span> CST <span style="color: #000000;">2010</span><br />
<span style="color: #666666;">root@krc:~# </span>hwclock <span style="color: #660033;">-r</span><br />
Tue <span style="color: #000000;">13</span> Jul <span style="color: #000000;">2010</span> 04:<span style="color: #000000;">26</span>:<span style="color: #000000;">45</span> PM CST -<span style="color: #000000;">0.001124</span> seconds</div></td></tr></tbody></table></div>
<p>3.建立计划任务</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">root@krc:~#</span>crontab <span style="color: #660033;">-e</span><br />
<span style="color: #666666; font-style: italic;"># m h dom mon dow command</span><br />
00 00 <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>webserver<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>cut_nginx_log.sh<br />
<span style="color: #000000;">28</span> <span style="color: #000000;">23</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>webmin<span style="color: #000000; font-weight: bold;">/</span>cron<span style="color: #000000; font-weight: bold;">/</span>tempdelete.pl<br />
<span style="color: #000000;">1</span> <span style="color: #000000;">0</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">1</span> <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">/</span>data1<span style="color: #000000; font-weight: bold;">/</span>backup_zone<span style="color: #000000; font-weight: bold;">/</span>data_www<span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #660033;">-mtime</span> +<span style="color: #000000;">28</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span><br />
<span style="color: #000000;">10</span> 00 <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">1</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>data1<span style="color: #000000; font-weight: bold;">/</span>backup_zone<span style="color: #000000; font-weight: bold;">/</span>data_www<span style="color: #000000; font-weight: bold;">/</span>snapfile<br />
<span style="color: #000000;">11</span> 00 <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>script-bak<span style="color: #000000; font-weight: bold;">/</span>bak_www.sh<br />
<span style="color: #000000;">1</span> <span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>script-bak<span style="color: #000000; font-weight: bold;">/</span>bak_conf.sh<br />
<span style="color: #000000;">11</span> <span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">1</span> <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">/</span>data1<span style="color: #000000; font-weight: bold;">/</span>backup_zone<span style="color: #000000; font-weight: bold;">/</span>data_conf<span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #660033;">-mtime</span> +<span style="color: #000000;">28</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span><br />
<span style="color: #000000; font-weight: bold;">*/</span><span style="color: #000000;">10</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>ntpdate t3.hshh.org <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>hwclock <span style="color: #660033;">-w</span></div></td></tr></tbody></table></div>
<p>4.参考资料</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">鸟哥的教程 http://linux.vbird.org/linux_server/0440ntp.php<br />
Public NTP Server http://support.ntp.org/bin/view/Servers/StratumTwoTimeServers<br />
Asia Public NTP Server http://www.pool.ntp.org/zone/asia</div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/870/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Collection]Vmware环境下，克隆Linux系统引发的网卡配置丢失问题</title>
		<link>http://99dev.net/archives/867</link>
		<comments>http://99dev.net/archives/867#comments</comments>
		<pubDate>Fri, 18 Jun 2010 07:48:59 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[其他Linux技术]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[network]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/867</guid>
		<description><![CDATA[系统环境 – Vmware WorkStation 7(同系列其他产品，如ESX/Esxi类似)
客户机操作系统 – Ubunt Linux Server 9.10

搭建测试环境，为了快速部署，使用Vmware的Clone功能，快速复制出许多客户机。
<span class="readmore"><a href="http://99dev.net/archives/867" title="[Collection]Vmware环境下，克隆Linux系统引发的网卡配置丢失问题" target="_blank">阅读全文——共707字</a></span>]]></description>
			<content:encoded><![CDATA[<blockquote><p>系统环境 – Vmware WorkStation 7(同系列其他产品，如ESX/Esxi类似)</p>
<p>客户机操作系统 – Ubunt Linux Server 9.10</p>
</blockquote>
<p>搭建测试环境，为了快速部署，使用Vmware的Clone功能，快速复制出许多客户机。</p>
<p>启动后发现个问题，除了源客户机，其他副本客户机，网络功能都不正常，具体表现为</p>
<ol>
<li>ifconfig输出的网络配置，只有lo，没有eth0 </li>
<li>“ifconfig –a”输出的网络配置中,eth0已经被自动修改为eth1了 </li>
<li>/etc/udev/rules.d/70-persistent-net.rules中，有eth0和eth1的详细定义。eth0为源客户机copy过来的；eth1为虚拟机自动生成的新网卡，定义区块的ATTR{address}记录着新网卡的mac(在虚拟机目录的VMX文件中，也能找到该mac地址) </li>
</ol>
<p> <span id="more-867"></span>
<ol><font size="5"><strong>故障分析</strong></font></ol>
<ol>为了避免同网段相同mac地址引发的广播风暴，Vmware自动添加了一块新网卡。Ubuntu识别并驱动了该网卡，却没有自动配置它，因此，出现上文那一幕。解决步骤Ubuntu Linux相关的网络配置</ol>
<ul>
<li>/etc/udev/rules.d/70-persistent-net.rules</li>
<li>/etc/network/interfaces</li>
</ul>
<p><font size="5"><strong>解决的思路有2个</strong></font></p>
<ul>
<li>删除/修改/etc/udev/rules.d/70-persistent-net.rules，事实证明，一般情况下，删除最方便，在networking服务重启的时候，会正确识别，并生成新的/etc/udev/rules.d/70-persistent-net.rules</li>
<li>修改interfaces，将其中的eth1统统替换为eth0<font color="#0000ff">(未验证)</font></li>
</ul>
<ol></ol>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/867/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Collection]Adding Date And Time To Your Bash History</title>
		<link>http://99dev.net/archives/861</link>
		<comments>http://99dev.net/archives/861#comments</comments>
		<pubDate>Fri, 11 Jun 2010 03:45:00 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[其他Linux技术]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/861</guid>
		<description><![CDATA[多人管理同一台Linux Server，为了方便审计，最好在history内加入操作时间。
It comes in handy particularly if there are multiple people maintaining a given server (so you can see when a command was performed) or even if you are the sole maintainer, but can&#8217;t remember exactly when you did or changed something. 
Edit your /etc/bashrc and append to the bottom:
<span class="readmore"><a href="http://99dev.net/archives/861" title="[Collection]Adding Date And Time To Your Bash History" target="_blank">阅读全文——共746字</a></span>]]></description>
			<content:encoded><![CDATA[<p>多人管理同一台Linux Server，为了方便审计，最好在history内加入操作时间。</p>
<p>It comes in handy particularly if there are multiple people maintaining a given server (so you can see when a command was performed) or even if you are the sole maintainer, but can&#8217;t remember exactly when you did or changed something. </p>
<p>Edit your /etc/bashrc and append to the bottom:</p>
<blockquote><p>export HISTTIMEFORMAT=&quot;%h/%d &#8211; %H:%M:%S &quot;</p>
</blockquote>
<p> <span id="more-861"></span>
<p>From next login instead of: </p>
<p>574&#160; tail -f /var/log/maillog    <br />575&#160; mailq | tail -15     <br />576&#160; tail -f /var/log/maillog     <br />577&#160; less /var/log/maillog </p>
<p>you get: </p>
<p>1002&#160; Apr/30 &#8211; 11:46:16 grep duncan /var/log/maillog    <br />1003&#160; Apr/30 &#8211; 14:17:40 passwd jduncan     <br />1004&#160; Apr/30 &#8211; 14:18:02 smbpasswd jduncan     <br />1005&#160; Apr/30 &#8211; 14:50:28 history 10 </p>
<p>Hope this helps someone;)</p>
<ul>
<ul>
<li>To make it global and permanent to all users, edit /etc/profile and append to the bottom<font color="#0000ff">(已测试通过)</font> </li>
<li>It works also in my Ubuntu box. The file to modify is $HOME/.bashrc<font color="#0000ff">(已测试通过)</font> </li>
</ul>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/861/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Original]有进程僵死,长期驻留在后台,杀不了</title>
		<link>http://99dev.net/archives/859</link>
		<comments>http://99dev.net/archives/859#comments</comments>
		<pubDate>Thu, 10 Jun 2010 07:13:36 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[Web服务器]]></category>
		<category><![CDATA[系统架构]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/859</guid>
		<description><![CDATA[故障现象
某Web服务器，突然出现以下问题，php-cgi僵死在进程里，无法重启
www 9463 0.0 0.3 41996 13612 ? D Apr19 1:22 /usr/local/php/bin/php-cgi &#8211;fpm      www 20858 0.0 0.3 40408 12932 ? D May05 1:55 /usr/local/php/bin/php-cgi &#8211;fpm       www 20866 0.0 0.3 40688 13296 ? D May05 1:53 /usr/local/php/bin/php-cgi &#8211;fpm       www 20878 0.0 0.3 40932 13604 ? D May05 1:51 /usr/local/php/bin/php-cgi &#8211;fpm       www 24288 0.0 0.3 40436 12880 ? D Apr15 2:36 /usr/local/php/bin/php-cgi &#8211;fpm       www 26881 0.0 0.3 41596 13712 ? D Apr16 6:11 /usr/local/php/bin/php-cgi &#8211;fpm       www 26921 0.0 0.3 43224 15848 ? D Apr16 5:57 /usr/local/php/bin/php-cgi &#8211;fpm       www 26983 0.0 0.3 42736 14524 ? D Apr16 6:01 /usr/local/php/bin/php-cgi &#8211;fpm       www 27007 0.0 0.3 42608 14248 ? D Apr16 6:01 /usr/local/php/bin/php-cgi &#8211;fpm       www 27023 0.0 0.3 42464 15172 ? D Apr16 5:57 /usr/local/php/bin/php-cgi –fpm
<span class="readmore"><a href="http://99dev.net/archives/859" title="[Original]有进程僵死,长期驻留在后台,杀不了" target="_blank">阅读全文——共938字</a></span>]]></description>
			<content:encoded><![CDATA[<p><font size="4"><strong>故障现象</strong></font></p>
<p>某Web服务器，突然出现以下问题，php-cgi僵死在进程里，无法重启</p>
<blockquote><p>www 9463 0.0 0.3 41996 13612 ? D Apr19 1:22 /usr/local/php/bin/php-cgi &#8211;fpm      <br />www 20858 0.0 0.3 40408 12932 ? D May05 1:55 /usr/local/php/bin/php-cgi &#8211;fpm       <br />www 20866 0.0 0.3 40688 13296 ? D May05 1:53 /usr/local/php/bin/php-cgi &#8211;fpm       <br />www 20878 0.0 0.3 40932 13604 ? D May05 1:51 /usr/local/php/bin/php-cgi &#8211;fpm       <br />www 24288 0.0 0.3 40436 12880 ? D Apr15 2:36 /usr/local/php/bin/php-cgi &#8211;fpm       <br />www 26881 0.0 0.3 41596 13712 ? D Apr16 6:11 /usr/local/php/bin/php-cgi &#8211;fpm       <br />www 26921 0.0 0.3 43224 15848 ? D Apr16 5:57 /usr/local/php/bin/php-cgi &#8211;fpm       <br />www 26983 0.0 0.3 42736 14524 ? D Apr16 6:01 /usr/local/php/bin/php-cgi &#8211;fpm       <br />www 27007 0.0 0.3 42608 14248 ? D Apr16 6:01 /usr/local/php/bin/php-cgi &#8211;fpm       <br />www 27023 0.0 0.3 42464 15172 ? D Apr16 5:57 /usr/local/php/bin/php-cgi –fpm</p>
</blockquote>
<p><font size="4"><strong>处理过程</strong></font></p>
<p> <span id="more-859"></span>
<p>1. “killall –9 php-cgi”无效</p>
<p>2. “pkill –9 php-cgi”无效</p>
<p>3. reboot操作系统，成功，D状态的php-cgi进程消失</p>
<p><font size="4"><strong>故障分析</strong></font></p>
<blockquote><p>D state 不是zombie进程，Z是zombie </p>
<p>D是uninterruptable sleep，看看dmesg里面是不是io driver出现问题了</p>
</blockquote>
<p><font size="4"><strong>~网上的几篇参考文章</strong></font></p>
<p>1. <a href="http://www.orczhou.com/index.php/2010/05/how-to-kill-an-uninterruptible-sleep-process/" target="_blank">How to kill an `uninterruptible sleep` process</a></p>
<p>2.<a href="http://blog.xupeng.me/2009/07/09/linux-uninterruptible-sleep-state/" target="_blank">Linux进程的Uninterruptible sleep(D)状态</a></p>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/859/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Original]主WEB服务器web service中断以及自动启动项不会up的问题</title>
		<link>http://99dev.net/archives/845</link>
		<comments>http://99dev.net/archives/845#comments</comments>
		<pubDate>Thu, 06 May 2010 01:53:04 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[Web服务器]]></category>
		<category><![CDATA[其他Linux技术]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nginx]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/845</guid>
		<description><![CDATA[# 查看默认的运行级别,Debian系默认运行级别为2,Redhat系默认运行级别为3
[11:34:29.9] root@webserver:/usr/local/webserver/nginx# runlevel
[11:34:31.8] N 2webserverwebserver

<span class="readmore"><a href="http://99dev.net/archives/845" title="[Original]主WEB服务器web service中断以及自动启动项不会up的问题" target="_blank">阅读全文——共2015字</a></span>]]></description>
			<content:encoded><![CDATA[<p># 查看默认的运行级别,Debian系默认运行级别为2,Redhat系默认运行级别为3</p>
<p>[11:34:29.9] root@webserver:/usr/local/webserver/nginx# runlevel</p>
<p>[11:34:31.8] N 2webserverwebserver</p>
<p><span id="more-845"></span>
<p>#运行开机启动项管理器,详细截图见sysv-rc-conf.png</p>
<p>[13:01:32.4] root@webserver:~# sysv-rc-conf</p>
<p>#可以看到存在一些不必要的启动服务,其中包含apache,该服务与nginx冲突</p>
<p>#确保rc.local服务在runlevel2被启用</p>
<p>#之前推测,nginx的https服务和kerio mailserver的https服务相冲突.结合了需求,该WebServer不会挂其他https站点.保留kerio mailserver,重新编译nginx,去掉https选项</p>
<p>[14:13:45.5] root@webserver:~/download/nginx-0.7.61# ./configure &#8211;user=www &#8211;group=www &#8211;prefix=/usr/local/webserver/nginx &#8211;with-http_stub_status_module</p>
<p>[14:14:04.9] root@webserver:~/download/nginx-0.7.61# make</p>
<p>#关闭有冲突的Apache Service</p>
<p>[13:07:10.1] root@webserver:~# /etc/init.d/apache2 stop</p>
<p>#关闭进程,重新安装nginx</p>
<p>[00:16:02.5] root@webserver:~# killall nginx</p>
<p>[00:16:12.6] root@webserver:~# cd /root/download</p>
<p>[00:16:28.7] root@webserver:~/download# cd nginx-0.7.61</p>
<p>[00:16:34.0] root@webserver:~/download/nginx-0.7.61# make install</p>
<p>[00:18:28.7] root@webserver:/usr/local/webserver/nginx/conf# nginx</p>
<p>#启动,测试rc.local是否成功执行</p>
<p>[00:26:00.2] root@webserver:/usr/local/webserver/nginx/conf# reboot</p>
<p>#查看nginx和php进程是否启动</p>
<p>[00:29:42.8] root@webserver:~# ps -aux|grep ngin</p>
<p>[00:29:55.9] www 6401 0.0 0.2 14764 11672 ? S 00:28 0:00 nginx: worker process</p>
<p>&nbsp;&nbsp;</p>
<p>[00:29:55.9] root@webserver:~# ps -aux|grep php</p>
<p>[00:29:59.9] root 6256 0.0 0.0 88624 3708 ? Ss 00:28 0:00 /usr/local/webserver/php/bin/php-cgi &#8211;fpm &#8211;fpm-config /usr/local/webserver/php/etc/php-fpm.conf</p>
<p>#陷阱1</p>
<p>The Mysterious &#8212; MARK &#8211;</p>
<p>All newbie admins asks what this means in /var/log/messages:</p>
<p>Jul 1 16:04:53 windbag &#8212; MARK &#8211;</p>
<p>Jul 1 16:24:53 windbag &#8212; MARK &#8211;</p>
<p>Jul 1 16:44:53 windbag &#8212; MARK &#8211;</p>
<p>That&#8217;s just the syslog daemon letting you know that it is alive and well. You may set the interval to anything you like on Debian by editing /etc/init.d/sysklogd. This sets it to 60 minutes:</p>
<p>SYSLOGD=”-m 60&#8243;</p>
<p>Then restart the syslog daemon:</p>
<p># /etc/init.d/sysklogd restart</p>
<p>On Red Hat and derivatives, edit /etc/sysconfig/syslog :</p>
<p>SYSLOGD_OPTIONS=”-m 60&#8243;</p>
<p>Restart syslogd with service syslog restart. Then watch it happen in realtime on any Linux with tail -f /var/log/messages. (You can monitor the changes in any text file with tail.)</p>
<p>#陷阱2</p>
<p>exiting due to signal 15</p>
<p>yslogd: exiting on signal 15 这个看上去是syslogd正常的退出信息</p>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/845/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Original]不能利用php的mail函数发送邮件的解决</title>
		<link>http://99dev.net/archives/844</link>
		<comments>http://99dev.net/archives/844#comments</comments>
		<pubDate>Thu, 29 Apr 2010 07:45:38 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[Web服务器]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/844</guid>
		<description><![CDATA[程序员反映在sun.xmnn.cn(192.168.96.55)不能利用PHP的mail()函数发送邮件。已解决。
设置步骤如下，

1.启动sendmail服务 /etc/init.d/sendmail start
<span class="readmore"><a href="http://99dev.net/archives/844" title="[Original]不能利用php的mail函数发送邮件的解决" target="_blank">阅读全文——共577字</a></span>]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: medium;">程序员反映在sun.xmnn.cn(192.168.96.55)不能利用PHP的mail()函数发送邮件。已解决。</span></p>
<p><span style="font-size: medium;">设置步骤如下，</span></p>
<p><span id="more-844"></span></p>
<p><span style="font-size: medium;">1.启动sendmail服务 /etc/init.d/sendmail start</span></p>
<p><span style="font-size: medium;">2.将sendmail服务加入开机启动项 chkconfig sendmail on</span></p>
<p>3.编辑access文件,加入以下域</p>
<p>vim /etc/mail/access</p>
<p>Connect:xmnn.cn RELAY</p>
<p>4.编辑php-fpm.conf文件，去除sendmail_path键值的注释符号</p>
<p>vim /data/php/etc/php-fpm.conf</p>
<p>&lt;value name=”sendmail_path”&gt;/usr/sbin/sendmail -t -i&lt;/value&gt;</p>
<p>5.编辑php.ini文件，设置sendmai_path变量</p>
<p>vim /data/php/etc/php.ini</p>
<p>sendmail_path = /usr/sbin/sendmail -t -i</p>
<p>6.该台服务器有设置nameserver。如没有的话，请编辑/etc/resolv.conf</p>
<p>加入以下内容</p>
<p>nameserver 202.101.103.55</p>
<p>nameserver 202.101.103.54</p>
<p>7.另，利用命令行测试系统sendmail是否可用，请参考<a href="http://linux.vbird.org/linux_server/0380sendmail.php">此文章</a>中“Linux 下使用 telnet 功能”小节。</p>
<p>附部分测试程序</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_METHOD'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'POST'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<br />
<span style="color: #000088;">$email</span><span style="color: #339933;">=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$to</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;hery78567650@163.com&quot;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$subject</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Test Mail Send by XMNN.Apps&quot;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Hello! This is a test sent by php.apps on sunbbs. Poople&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$email</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$from</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;sun@xmnn.cn&quot;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$headers</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;From: <span style="color: #006699; font-weight: bold;">$from</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">.</span><br />
<br />
<span style="color: #0000ff;">&quot;CC: 7215030@qq.com&quot;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/mail"><span style="color: #990000;">mail</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$to</span><span style="color: #339933;">,</span><span style="color: #000088;">$subject</span><span style="color: #339933;">,</span><span style="color: #000088;">$message</span><span style="color: #339933;">,</span><span style="color: #000088;">$headers</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<br />
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;????&quot;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/844/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

