<?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/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>おいぬま日報 &#187; Linux</title>
	<atom:link href="http://tech.lampetty.net/tech/index.php/archives/category/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://tech.lampetty.net/tech</link>
	<description>Apache, MySQL, Perl, Python あたり</description>
	<lastBuildDate>Sun, 05 Feb 2012 12:36:09 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/category/linux/feed" />
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>Linuxで容量の大きいディレクトリを調べる</title>
		<link>http://tech.lampetty.net/tech/index.php/archives/407?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=linux%25e3%2581%25a7%25e5%25ae%25b9%25e9%2587%258f%25e3%2581%25ae%25e5%25a4%25a7%25e3%2581%258d%25e3%2581%2584%25e3%2583%2587%25e3%2582%25a3%25e3%2583%25ac%25e3%2582%25af%25e3%2583%2588%25e3%2583%25aa%25e3%2582%2592%25e8%25aa%25bf%25e3%2581%25b9%25e3%2582%258b</link>
		<comments>http://tech.lampetty.net/tech/index.php/archives/407#comments</comments>
		<pubDate>Sun, 10 Apr 2011 00:03:52 +0000</pubDate>
		<dc:creator>oinume</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[SysAdmin]]></category>

		<guid isPermaLink="false">http://tech.lampetty.net/tech/?p=407</guid>
		<description><![CDATA[# du -m /home &#124; sort -nr &#124; head -5 で容量の大きいディレクトリTOP5調べられる。]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># du -m /home | sort -nr | head -5</span></pre></div></div>

<p>で容量の大きいディレクトリTOP5調べられる。</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.lampetty.net/tech/index.php/archives/407/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/407" />
	</item>
		<item>
		<title>wgetでURLにアクセスできるか簡易的にチェックする</title>
		<link>http://tech.lampetty.net/tech/index.php/archives/400?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wget%25e3%2581%25a7url%25e3%2581%25ab%25e3%2582%25a2%25e3%2582%25af%25e3%2582%25bb%25e3%2582%25b9%25e3%2581%25a7%25e3%2581%258d%25e3%2582%258b%25e3%2581%258b%25e7%25b0%25a1%25e6%2598%2593%25e7%259a%2584%25e3%2581%25ab%25e3%2583%2581%25e3%2582%25a7%25e3%2583%2583%25e3%2582%25af%25e3%2581%2599%25e3%2582%258b</link>
		<comments>http://tech.lampetty.net/tech/index.php/archives/400#comments</comments>
		<pubDate>Wed, 16 Feb 2011 15:36:51 +0000</pubDate>
		<dc:creator>oinume</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[SysAdmin]]></category>

		<guid isPermaLink="false">http://tech.lampetty.net/tech/?p=400</guid>
		<description><![CDATA[Webサーバがちゃんと立ち上がったかどうか、URLにアクセスしてチェックしたいので。 wget -o /dev/null -O - http://twitter.com/ &#62; /dev/null if &#91;  [...]]]></description>
			<content:encoded><![CDATA[<p>Webサーバがちゃんと立ち上がったかどうか、URLにアクセスしてチェックしたいので。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">-O</span> - http:<span style="color: #000000; font-weight: bold;">//</span>twitter.com<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">&gt;</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;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;OK&quot;</span>
<span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Failure!!&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>な感じかなぁ。<br />
<div class="tmkm-amazon-view">
	<p><a href="http://www.amazon.co.jp/%E4%BB%95%E4%BA%8B%E3%81%AB%E4%BD%BF%E3%81%88%E3%82%8BLinux%E3%82%B7%E3%82%A7%E3%83%AB%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%7Ebash%E3%81%A7%E4%BD%9C%E3%82%8B%E5%AE%9F%E7%94%A8%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB41-%E5%8D%83%E8%91%89-%E7%9C%9F%E4%BA%BA/dp/4822282090%3FSubscriptionId%3DAKIAJGVWECUONT35GEJA%26tag%3Dkazzhomeunixo-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4822282090"><img src="http://ecx.images-amazon.com/images/I/51W1JPHPGZL._SL160_.jpg" border="0" alt="" /></a></p>
	<p><a href="http://www.amazon.co.jp/%E4%BB%95%E4%BA%8B%E3%81%AB%E4%BD%BF%E3%81%88%E3%82%8BLinux%E3%82%B7%E3%82%A7%E3%83%AB%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%7Ebash%E3%81%A7%E4%BD%9C%E3%82%8B%E5%AE%9F%E7%94%A8%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB41-%E5%8D%83%E8%91%89-%E7%9C%9F%E4%BA%BA/dp/4822282090%3FSubscriptionId%3DAKIAJGVWECUONT35GEJA%26tag%3Dkazzhomeunixo-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4822282090">仕事に使えるLinuxシェルスクリプト~bashで作る実用サンプル41</a></p>
	<p><em>著者／訳者：</em>千葉 真人</p>
	<p><em>出版社：</em>日経BP社( 2004-11-25 )</p>
	<p>単行本 ( 381 ページ )</p>
<hr class="tmkm-amazon-clear" /></div>
]]></content:encoded>
			<wfw:commentRss>http://tech.lampetty.net/tech/index.php/archives/400/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/400" />
	</item>
		<item>
		<title>watchでコマンドの出力を監視する</title>
		<link>http://tech.lampetty.net/tech/index.php/archives/388?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=watch%25e3%2581%25a7%25e3%2582%25b3%25e3%2583%259e%25e3%2583%25b3%25e3%2583%2589%25e3%2581%25ae%25e5%2587%25ba%25e5%258a%259b%25e3%2582%2592%25e7%259b%25a3%25e8%25a6%2596%25e3%2581%2599%25e3%2582%258b</link>
		<comments>http://tech.lampetty.net/tech/index.php/archives/388#comments</comments>
		<pubDate>Sun, 31 Oct 2010 14:49:48 +0000</pubDate>
		<dc:creator>oinume</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://tech.lampetty.net/tech/?p=388</guid>
		<description><![CDATA[Unixには watch という、n秒ごとに定期的にコマンドを実行してその出力を表示するコマンドがあります。 例えば netstat -na した結果を wc で数えて現在のコネクション数を1秒ごとに表示するには $ w [...]]]></description>
			<content:encoded><![CDATA[<p>Unixには watch という、n秒ごとに定期的にコマンドを実行してその出力を表示するコマンドがあります。</p>
<p>例えば netstat -na した結果を wc で数えて現在のコネクション数を1秒ごとに表示するには</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">watch</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">1</span> <span style="color: #ff0000;">'netstat -na | wc -l'</span></pre></div></div>

<p>とやります。このコマンドを知る前までは</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">true</span>; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #c20cb9; font-weight: bold;">netstat</span> <span style="color: #660033;">-na</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> <span style="color: #660033;">-l</span>; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span>; <span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>とやっていてタイプするのが面倒だったので、かなり楽になりました。</p>
<p>補足ですが、時系列でコマンドの出力を表示させたい場合もあるので、while true; do netstat -na | wc -l; sleep 1; done のやり方も場合によっては全然有効だと思います。</p>
<div class="tmkm-amazon-view">
	<p><a href="http://www.amazon.co.jp/%E5%85%A5%E9%96%80UNIX%E3%82%B7%E3%82%A7%E3%83%AB%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%E2%80%95%E3%82%B7%E3%82%A7%E3%83%AB%E3%81%AE%E5%9F%BA%E7%A4%8E%E3%81%8B%E3%82%89%E5%AD%A6%E3%81%B6UNIX%E3%81%AE%E4%B8%96%E7%95%8C-%E3%83%96%E3%83%AB%E3%83%BC%E3%82%B9-%E3%83%96%E3%83%AA%E3%83%B3/dp/4797321946%3FSubscriptionId%3DAKIAJGVWECUONT35GEJA%26tag%3Dkazzhomeunixo-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4797321946"><img src="http://ecx.images-amazon.com/images/I/41shA4AJs9L._SL160_.jpg" border="0" alt="" /></a></p>
	<p><a href="http://www.amazon.co.jp/%E5%85%A5%E9%96%80UNIX%E3%82%B7%E3%82%A7%E3%83%AB%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%E2%80%95%E3%82%B7%E3%82%A7%E3%83%AB%E3%81%AE%E5%9F%BA%E7%A4%8E%E3%81%8B%E3%82%89%E5%AD%A6%E3%81%B6UNIX%E3%81%AE%E4%B8%96%E7%95%8C-%E3%83%96%E3%83%AB%E3%83%BC%E3%82%B9-%E3%83%96%E3%83%AA%E3%83%B3/dp/4797321946%3FSubscriptionId%3DAKIAJGVWECUONT35GEJA%26tag%3Dkazzhomeunixo-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4797321946">入門UNIXシェルプログラミング―シェルの基礎から学ぶUNIXの世界</a></p>
	<p><em>著者／訳者：</em>ブルース ブリン</p>
	<p><em>出版社：</em>ソフトバンククリエイティブ( 2003-02 )</p>
	<p>単行本 ( 434 ページ )</p>
<hr class="tmkm-amazon-clear" /></div>
]]></content:encoded>
			<wfw:commentRss>http://tech.lampetty.net/tech/index.php/archives/388/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/388" />
	</item>
		<item>
		<title>Gitの共有リポジトリを運用する場合の個人的なベストプラクティス</title>
		<link>http://tech.lampetty.net/tech/index.php/archives/353?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e5%2580%258b%25e4%25ba%25ba%25e7%259a%2584%25e3%2581%25aagit%25e3%2582%25b5%25e3%2583%25bc%25e3%2583%2590%25e3%2582%2592%25e7%25ab%258b%25e3%2581%25a6%25e3%2582%258b%25e3%2583%2599%25e3%2582%25b9%25e3%2583%2588%25e3%2583%2597%25e3%2583%25a9%25e3%2582%25af%25e3%2583%2586%25e3%2582%25a3%25e3%2582%25b9</link>
		<comments>http://tech.lampetty.net/tech/index.php/archives/353#comments</comments>
		<pubDate>Thu, 17 Dec 2009 13:23:36 +0000</pubDate>
		<dc:creator>oinume</dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://tech.lampetty.net/tech/?p=353</guid>
		<description><![CDATA[最近Gitの共有リポジトリを構築する機会があったのですが、以下のような感じで運用しています。 gitプロトコルではなくsshでアクセス(ポート開けるのだるいので) サーバ側にgitユーザを作って、アクセスさせたい人にss [...]]]></description>
			<content:encoded><![CDATA[<p>最近Gitの共有リポジトリを構築する機会があったのですが、以下のような感じで運用しています。</p>
<ul>
<li>gitプロトコルではなくsshでアクセス(ポート開けるのだるいので)</li>
<li>サーバ側にgitユーザを作って、アクセスさせたい人にsshの公開鍵をもらってそれを /home/git/.ssh/authorized_keys に追加して公開鍵認証</li>
<li>git clone ssh://git@lampetty.net/var/cache/git/hoge.git みたいな感じでclone</li>
</ul>
<p>いちいちサーバ側にユーザ追加して、gitリポジトリのディレクトリにパーミッション付与するよりこっちの方がたぶん楽。</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.lampetty.net/tech/index.php/archives/353/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/353" />
	</item>
		<item>
		<title>bashでコマンド履歴を残さない方法</title>
		<link>http://tech.lampetty.net/tech/index.php/archives/329?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=bash%25e3%2581%25a7%25e3%2582%25b3%25e3%2583%259e%25e3%2583%25b3%25e3%2583%2589%25e5%25b1%25a5%25e6%25ad%25b4%25e3%2582%2592%25e6%25ae%258b%25e3%2581%2595%25e3%2581%25aa%25e3%2581%2584%25e6%2596%25b9%25e6%25b3%2595</link>
		<comments>http://tech.lampetty.net/tech/index.php/archives/329#comments</comments>
		<pubDate>Sat, 15 Aug 2009 14:23:47 +0000</pubDate>
		<dc:creator>oinume</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://tech.lampetty.net/tech/?p=329</guid>
		<description><![CDATA[bashには過去に実行したコマンドを履歴として残しているので、CTRL+pなどでその履歴をさかのぼり過去に実行したコマンドをそのまま実行したり、ちょこっと直して実行することができます。しかし、この便利な機能は一方で、 r [...]]]></description>
			<content:encoded><![CDATA[<p>bashには過去に実行したコマンドを履歴として残しているので、CTRL+pなどでその履歴をさかのぼり過去に実行したコマンドをそのまま実行したり、ちょこっと直して実行することができます。しかし、この便利な機能は一方で、 rm などのファイルを削除したりするような危険なコマンドを、履歴からいとも簡単に実行してしまい、結果として大切なファイルを消してしまったりするようなミスを誘発する恐れがあります。</p>
<p>そんなことを考える人に「特定のコマンドだけ履歴に残したくない(=.bash_historyに残さない)という技を紹介したいと思います。具体的には</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTIGNORE</span>=<span style="color: #ff0000;">'rm*:mv*'</span></pre></div></div>

<p>のように、環境変数HISTIGNOREに履歴に残したくないコマンドを設定します。:(コロン)でコマンドを区切ることで複数のコマンドを設定することが可能です。上記の例では rm と mv を履歴に残さないようにしています。</p>
<p>実際に試してみると</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">touch</span> hoge
$ <span style="color: #c20cb9; font-weight: bold;">rm</span> hoge
$ <span style="color: #7a0874; font-weight: bold;">history</span>
   ...
   <span style="color: #000000;">98</span>  <span style="color: #c20cb9; font-weight: bold;">touch</span> hoge
   <span style="color: #000000;">99</span>  <span style="color: #7a0874; font-weight: bold;">history</span></pre></div></div>

<p>のようにrmコマンドはhistoryには残っていません。実行前にコマンドを確認しないで、うっかり履歴からrmコマンドで必要なファイルを消してしまった、というようなオペレーションミス対策になると思うので、重要なサーバではぜひ設定してみると良いと思います。</p>
<div class="tmkm-amazon-view">
	<p><a href="http://www.amazon.co.jp/bash%E3%82%AF%E3%83%83%E3%82%AF%E3%83%96%E3%83%83%E3%82%AF-Carl-Albing/dp/4873113768%3FSubscriptionId%3DAKIAJGVWECUONT35GEJA%26tag%3Dkazzhomeunixo-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4873113768"><img src="http://ecx.images-amazon.com/images/I/51mNJmDAzSL._SL160_.jpg" border="0" alt="" /></a></p>
	<p><a href="http://www.amazon.co.jp/bash%E3%82%AF%E3%83%83%E3%82%AF%E3%83%96%E3%83%83%E3%82%AF-Carl-Albing/dp/4873113768%3FSubscriptionId%3DAKIAJGVWECUONT35GEJA%26tag%3Dkazzhomeunixo-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4873113768">bashクックブック</a></p>
	<p><em>著者／訳者：</em>Carl Albing JP Vossen Cameron Newham </p>
	<p><em>出版社：</em>オライリージャパン( 2008-09-26 )</p>
	<p>大型本 ( 644 ページ )</p>
<hr class="tmkm-amazon-clear" /></div>
]]></content:encoded>
			<wfw:commentRss>http://tech.lampetty.net/tech/index.php/archives/329/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/329" />
	</item>
		<item>
		<title>Apacheが&#8221;Couldn&#8217;t create accept lock&#8221;で起動しない場合の対処方法</title>
		<link>http://tech.lampetty.net/tech/index.php/archives/317?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=apache%25e3%2581%258ccouldnt-create-accept-lock%25e3%2581%25a7%25e8%25b5%25b7%25e5%258b%2595%25e3%2581%2597%25e3%2581%25aa%25e3%2581%2584%25e5%25a0%25b4%25e5%2590%2588%25e3%2581%25ae%25e5%25af%25be%25e5%2587%25a6%25e6%2596%25b9%25e6%25b3%2595</link>
		<comments>http://tech.lampetty.net/tech/index.php/archives/317#comments</comments>
		<pubDate>Wed, 10 Jun 2009 14:21:30 +0000</pubDate>
		<dc:creator>oinume</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://tech.lampetty.net/tech/?p=317</guid>
		<description><![CDATA[これの続編なのですが、複数人が共同で使っているサーバなどで、Apacheのプロセスを何個も起動していると、使えるセマフォがなくなるという事態に遭遇することがあります。対処方法は、Apacheを止めるか $ for sem [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://diary.lampetty.net/20070613.html">これ</a>の続編なのですが、複数人が共同で使っているサーバなどで、Apacheのプロセスを何個も起動していると、使える<a href="http://itpro.nikkeibp.co.jp/article/COLUMN/20060602/239824/">セマフォ</a>がなくなるという事態に遭遇することがあります。対処方法は、Apacheを止めるか</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">for</span> semid <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span>ipcs <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> www-data <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-f2</span> <span style="color: #660033;">-d</span><span style="color: #ff0000;">&quot; &quot;</span><span style="color: #000000; font-weight: bold;">`</span>; <span style="color: #000000; font-weight: bold;">do</span> ipcrm <span style="color: #660033;">-s</span> <span style="color: #007800;">$semid</span>; <span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>としてセマフォを削除すれば解決しますが、どうしてもたくさんのApacheのプロセスを立ち上げたい場合は、kernelパラメータのkernel.semの値を大きくしてみると良いでしょう。</p>
<p>Ubuntu 9.04 Server版の kernel.sem のデフォルト値は</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>kernel<span style="color: #000000; font-weight: bold;">/</span>sem
<span style="color: #000000;">250</span>     <span style="color: #000000;">32000</span>   <span style="color: #000000;">32</span>      <span style="color: #000000;">128</span></pre></div></div>

<p>となっていて、この4つの数値は左から</p>
<ul>
<li>SEMMSL: セマフォ集合ごとのセマフォ数の最大値。</li>
<li>SEMMNS: システム全体での、全てのセマフォ集合におけるセマフォ数の制限。</li>
<li>SEMOPM: semop(2)コールに指定されるオペレーション数の最大値。</li>
<li>SEMMNIシステム全体でのセマフォ識別子の最大値。</li>
</ul>
<p>というものらしいです。</p>
<p>今回はためしにこの4つの数値を倍に設定してみましょう。設定するには /etc/sysctl.conf に以下の行を追加します。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">kernel.sem    = <span style="color: #000000;">500</span> <span style="color: #000000;">64000</span> <span style="color: #000000;">64</span> <span style="color: #000000;">256</span></pre></div></div>

<p>完了したら</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> sysctl <span style="color: #660033;">-p</span></pre></div></div>

<p>を実行するとすぐに反映されます。これでApacheが意味不明な&#8221;Couldn&#8217;t create accept lock&#8221;というエラーを吐かなくなるはずです。</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.lampetty.net/tech/index.php/archives/317/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/317" />
	</item>
	</channel>
</rss>

