<?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>@blog.justoneplanet.info &#187; Linux</title>
	<atom:link href="http://blog.justoneplanet.info/category/computer/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.justoneplanet.info</link>
	<description>日々勉強</description>
	<lastBuildDate>Wed, 08 Feb 2012 02:57:17 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Elastic IPを別のホストに関連付ける</title>
		<link>http://blog.justoneplanet.info/2012/01/21/elastic-ip%e3%82%92%e5%88%a5%e3%81%ae%e3%83%9b%e3%82%b9%e3%83%88%e3%81%ab%e9%96%a2%e9%80%a3%e4%bb%98%e3%81%91%e3%82%8b/</link>
		<comments>http://blog.justoneplanet.info/2012/01/21/elastic-ip%e3%82%92%e5%88%a5%e3%81%ae%e3%83%9b%e3%82%b9%e3%83%88%e3%81%ab%e9%96%a2%e9%80%a3%e4%bb%98%e3%81%91%e3%82%8b/#comments</comments>
		<pubDate>Sat, 21 Jan 2012 03:53:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.justoneplanet.info/?p=4970</guid>
		<description><![CDATA[Elastic IPを別のホストに関連付けた後でmacのターミナルからsshでアクセスしようとすると以下のようなエラーが出る。 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ [...]]]></description>
			<content:encoded><![CDATA[<p>Elastic IPを別のホストに関連付けた後でmacのターミナルからsshでアクセスしようとすると以下のようなエラーが出る。</p>
<pre class="brush: plain;">
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
00:88:66:99:77:aa:bb:cc:dd:ee:ff:11:22:33:44:55.
Please contact your system administrator.
Add correct host key in /Users/name/.ssh/known_hosts to get rid of this message.
Offending key in /Users/name/.ssh/known_hosts:7
RSA host key for 123.123.123.123 has changed and you have requested strict checking.
Host key verification failed.
</pre>
<p>以前に同じ証明書で接続したホストとフィンガープリントが変わっていると警告してくれている。以下のようにして対処する。</p>
<pre class="brush: bash;">
ssh-keygen -R 123.123.123.123
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.justoneplanet.info/2012/01/21/elastic-ip%e3%82%92%e5%88%a5%e3%81%ae%e3%83%9b%e3%82%b9%e3%83%88%e3%81%ab%e9%96%a2%e9%80%a3%e4%bb%98%e3%81%91%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOSにHaskellを入れる</title>
		<link>http://blog.justoneplanet.info/2012/01/09/centos%e3%81%abhaskell%e3%82%92%e5%85%a5%e3%82%8c%e3%82%8b/</link>
		<comments>http://blog.justoneplanet.info/2012/01/09/centos%e3%81%abhaskell%e3%82%92%e5%85%a5%e3%82%8c%e3%82%8b/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 05:47:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Haskell]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.justoneplanet.info/?p=4917</guid>
		<description><![CDATA[めも。 ■ghc wget http://www.haskell.org/ghc/dist/7.2.2/ghc-7.2.2-x86_64-unknown-linux.tar.bz2 tar xvfj ghc-7.2.2- [...]]]></description>
			<content:encoded><![CDATA[<p>めも。</p>
<h3>■ghc</h3>
<pre class="brush: bash;">
wget http://www.haskell.org/ghc/dist/7.2.2/ghc-7.2.2-x86_64-unknown-linux.tar.bz2
tar xvfj ghc-7.2.2-x86_64-unknown-linux.tar.bz2
cd ghc-7.2.2
./configure --prefix=/usr/local/haskell/ghc/7.2.2
make install
export PATH=/usr/local/haskell/ghc/7.2.2/bin:$PATH
</pre>
<h4>コーディング</h4>
<pre class="brush: bash;">
vim hello.hs
</pre>
<pre class="brush: plain;">
main = putStrLn &quot;Hello World&quot;
</pre>
<h4>実行</h4>
<p>以下のコマンドでコンパイルと実行が同時にできる。</p>
<pre class="brush: bash;">
ghc -e main hello.hs
</pre>
<p>もしくは以下のコマンドを実行する。</p>
<pre class="brush: bash;">
ghc --make hello.hs
./hello
</pre>
<section class="kakomi">
<h4>インタプリタ</h4>
<p>以下のコマンドで起動する。</p>
<pre class="brush: bash;">
ghci
</pre>
<p>以下のようにしてインストールできる。</p>
<pre class="brush: bash;">
Prelude&gt; putStrLn &quot;Hello World&quot;
Hello World
</pre>
<p>以下のようにしてインタプリタを終了できる。</p>
<pre class="brush: bash;">
&lt;ctrl&gt;+D
</pre>
</section>
<h4>エラー</h4>
<pre class="brush: bash;">
&lt;command line&gt;: can't load .so/.DLL for: libgmp.so (libgmp.so: cannot open shared object file: No such file or directory)
</pre>
<p>以下のコマンドで解決できる。</p>
<pre class="brush: bash;">
cd /usr/lib64
ln -s libgmp.so.3 libgmp.so
</pre>
<section class="kakomi">
<h4>参考</h4>
<ul>
<li><a href="http://www.haskell.org/ghc/">The Glasgow Haskell Compiler</a></li>
</ul>
</section>
<h3>■hugs</h3>
<p>インタプリタ。ghciもあるので必要がないと思われる。</p>
<pre class="brush: bash;">
wget http://cvs.haskell.org/Hugs/downloads/2006-09/hugs98-Sep2006.tar.gz
tar xvzf hugs98-Sep2006.tar.gz
cd hugs98-Sep2006
./configure
make
make install
</pre>
<h4>開始</h4>
<pre class="brush: bash;">
hugs
</pre>
<h4>終了</h4>
<pre class="brush: bash;">
&lt;ctrl&gt;+D
</pre>
<h4>Hello World</h4>
<pre class="brush: bash;">
Hugs&gt; putStrLn &quot;Hello World&quot;
Hello World
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.justoneplanet.info/2012/01/09/centos%e3%81%abhaskell%e3%82%92%e5%85%a5%e3%82%8c%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOSにjenkinsをインストールする</title>
		<link>http://blog.justoneplanet.info/2011/10/20/centos%e3%81%abjenkins%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b/</link>
		<comments>http://blog.justoneplanet.info/2011/10/20/centos%e3%81%abjenkins%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 02:46:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.justoneplanet.info/?p=4956</guid>
		<description><![CDATA[以下のコマンドでインストールできる。 yum install java-1.6.0-openjdk wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci. [...]]]></description>
			<content:encoded><![CDATA[<p>以下のコマンドでインストールできる。</p>
<pre class="brush: bash;">
yum install java-1.6.0-openjdk
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
yum install jenkins
</pre>
<p>デフォルトのJENKINS_HOMEは以下のようになる。</p>
<pre class="brush: bash;">
/var/lib/jenkins
</pre>
<h3>■ポート変更</h3>
<p>以下のコマンドで設定ファイルを編集する。</p>
<pre class="brush: bash;">
vim /etc/sysconfig/jenkins
</pre>
<p>デフォルトでは8080番を使用しているので以下のように変更する。</p>
<pre class="brush: bash;">
JENKINS_PORT=&quot;1234&quot;
</pre>
<h3>■起動</h3>
<pre class="brush: bash;">
/sbin/service jenkins start
</pre>
<p>以下のアドレスでアクセスできる。</p>
<pre class="brush: bash;">

http://localhost:8080/
</pre>
<h3>■セキュリティ</h3>
<p>以下のURLにアクセスする。</p>
<pre class="brush: bash;">

http://localhost:8080/configure
</pre>
<p>デフォルトではすべてのユーザが閲覧可能でありジョブを追加することができるので、「セキュリティを有効化」の項目にチェックを入れる。</p>
<section class="kakomi">
<h4>特定のユーザのみが操作可能にする</h4>
<h5>Jenkinsのユーザーデータベース</h5>
<p>Jenkinsのユーザーデータベースを選択し、ユーザーにサインアップを許可を外して一度保存する。</p>
<h5>権限管理</h5>
<p>行列による権限設定を選択し、上述で追加したユーザ名に対して全権限を与える。また、匿名ユーザには必要な権限だけ付加する。</p>
</section>
<p>Unixユーザを使用した管理の方が便利かもしれない。</p>
<h3>■E-mail通知</h3>
<p>以下のURLにアクセスする。</p>
<pre class="brush: bash;">

http://localhost:8080/configure
</pre>
<p>SMTP認証にチェックを入れ以下のように入力する。</p>
<dl>
<dt>SMTPサーバー</dt>
<dd>mail.example.com</dd>
<dt>E-mailのサフィックス</dt>
<dd>@example.com</dd>
<dt>送信元メールアドレス</dt>
<dd>john@sample.com</dd>
<dt>ユーザ名</dt>
<dd>mike</dd>
<dt>パスワード</dt>
<dd>mike&#8217;s_pasword</dd>
<dt>SMTPポート</dt>
<dd>587</dd>
<dl>
<p>メールを送信して設定を確認にチェックを入れて実際にメールが送信できるか確認する。</p>
<h3>■JDKのインストール</h3>
<p>以下のURLにアクセスする。</p>
<pre class="brush: bash;">

http://localhost:8080/configure
</pre>
<p>JDKの項目があるので入力して保存する。oracleアカウントが面倒。</p>
<h3>■Git連携</h3>
<p>以下の画面にアクセスする。</p>
<pre class="brush: bash;">

http://localhost:8080/pluginManager/available
</pre>
<p>Git Pluginを選択し「ダウンロード後に再起動しインストール」を選択する。</p>
<h4>gitの設定</h4>
<p>http://localhost:8080/job/SampleProject/configure</p>
<section class="kakomi">
<h4>android</h4>
<p>以下にアクセスしてAndroid Emulator Pluginをインストールする。</p>
<pre class="brush: bash;">

http://localhost:8080/pluginManager/available
</pre>
</section>
]]></content:encoded>
			<wfw:commentRss>http://blog.justoneplanet.info/2011/10/20/centos%e3%81%abjenkins%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>gitで過去のcommitに対してbranchをきる</title>
		<link>http://blog.justoneplanet.info/2011/08/25/git%e3%81%a7%e9%81%8e%e5%8e%bb%e3%81%aecommit%e3%81%ab%e5%af%be%e3%81%97%e3%81%a6branch%e3%82%92%e3%81%8d%e3%82%8b/</link>
		<comments>http://blog.justoneplanet.info/2011/08/25/git%e3%81%a7%e9%81%8e%e5%8e%bb%e3%81%aecommit%e3%81%ab%e5%af%be%e3%81%97%e3%81%a6branch%e3%82%92%e3%81%8d%e3%82%8b/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 01:40:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.justoneplanet.info/?p=4335</guid>
		<description><![CDATA[まず、コミットのハッシュ値を調べる gitx gitxを入れていない場合は以下のコマンドで調べる。 git log --all --graph 以下のコマンドで一度チェックアウトしたあとブランチを切った後、元のブランチを [...]]]></description>
			<content:encoded><![CDATA[<p>まず、コミットのハッシュ値を調べる</p>
<pre class="brush: bash;">
gitx
</pre>
<p>gitxを入れていない場合は以下のコマンドで調べる。</p>
<pre class="brush: bash;">
git log --all --graph
</pre>
<p>以下のコマンドで一度チェックアウトしたあとブランチを切った後、元のブランチをチェックアウトする。</p>
<pre class="brush: bash;">
git checkout 1234567
git branch -a
git checkout -b forgetbranch
git checkout master
</pre>
<p>addしてないファイルとかあると少し面倒になる。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.justoneplanet.info/2011/08/25/git%e3%81%a7%e9%81%8e%e5%8e%bb%e3%81%aecommit%e3%81%ab%e5%af%be%e3%81%97%e3%81%a6branch%e3%82%92%e3%81%8d%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>reboot時にコマンドを実行する</title>
		<link>http://blog.justoneplanet.info/2011/08/19/reboot%e6%99%82%e3%81%ab%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%82%92%e5%ae%9f%e8%a1%8c%e3%81%99%e3%82%8b/</link>
		<comments>http://blog.justoneplanet.info/2011/08/19/reboot%e6%99%82%e3%81%ab%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%82%92%e5%ae%9f%e8%a1%8c%e3%81%99%e3%82%8b/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 13:23:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.justoneplanet.info/?p=4324</guid>
		<description><![CDATA[以下のコマンドでファイルを編集する。 vi /etc/rc.d/rc.local 以下のような記述があると思う。 touch /var/lock/subsys/local 最終行に起動時に実行したいコマンドを記述する。  [...]]]></description>
			<content:encoded><![CDATA[<p>以下のコマンドでファイルを編集する。</p>
<pre class="brush: bash;">
vi /etc/rc.d/rc.local
</pre>
<p>以下のような記述があると思う。</p>
<pre class="brush: bash;">
touch /var/lock/subsys/local
</pre>
<p>最終行に起動時に実行したいコマンドを記述する。</p>
<pre class="brush: bash;">
ulimit -n 32768
/home/hogehoge/fugafuga/check.sh &gt; /home/hogehoge/fugafuga/result.txt &amp;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.justoneplanet.info/2011/08/19/reboot%e6%99%82%e3%81%ab%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%82%92%e5%ae%9f%e8%a1%8c%e3%81%99%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>macからgithubを使う</title>
		<link>http://blog.justoneplanet.info/2011/08/15/mac%e3%81%8b%e3%82%89github%e3%82%92%e4%bd%bf%e3%81%86/</link>
		<comments>http://blog.justoneplanet.info/2011/08/15/mac%e3%81%8b%e3%82%89github%e3%82%92%e4%bd%bf%e3%81%86/#comments</comments>
		<pubDate>Mon, 15 Aug 2011 13:21:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.justoneplanet.info/?p=4311</guid>
		<description><![CDATA[そーいやmacで使ってなかったので一応メモ。 cd ~/.ssh sh-3.2# ssh-keygen -t rsa -C &#34;user@hogehoge.com&#34; Generating public/ [...]]]></description>
			<content:encoded><![CDATA[<p>そーいやmacで使ってなかったので一応メモ。</p>
<pre class="brush: bash;">
cd ~/.ssh
sh-3.2# ssh-keygen -t rsa -C &quot;user@hogehoge.com&quot;
Generating public/private rsa key pair.
Enter file in which to save the key (/var/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/root/.ssh/id_rsa.
Your public key has been saved in /var/root/.ssh/id_rsa.pub.
</pre>
<p>以下のコマンドで内容をメモる。</p>
<pre class="brush: bash;">
vi id_rsa.pub
</pre>
<p><a href="https://github.com/account/ssh">Account Settings</a>のキーの方にペーストする。</p>
<pre class="brush: bash;">
ssh -T git@github.com
Hi hogehoge! You've successfully authenticated, but GitHub does not provide shell access.
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.justoneplanet.info/2011/08/15/mac%e3%81%8b%e3%82%89github%e3%82%92%e4%bd%bf%e3%81%86/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>httpd restartでAddress already in useが表示されたとき</title>
		<link>http://blog.justoneplanet.info/2011/08/15/httpd-restart%e3%81%a7address-already-in-use%e3%81%8c%e8%a1%a8%e7%a4%ba%e3%81%95%e3%82%8c%e3%81%9f%e3%81%a8%e3%81%8d/</link>
		<comments>http://blog.justoneplanet.info/2011/08/15/httpd-restart%e3%81%a7address-already-in-use%e3%81%8c%e8%a1%a8%e7%a4%ba%e3%81%95%e3%82%8c%e3%81%9f%e3%81%a8%e3%81%8d/#comments</comments>
		<pubDate>Mon, 15 Aug 2011 12:04:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.justoneplanet.info/?p=4308</guid>
		<description><![CDATA[以下のコマンドでapacheを再起動する。 /etc/init.d/httpd restart 以下のようなメッセージが表示されて再起動できなくなる。 Starting httpd: (98)Address alread [...]]]></description>
			<content:encoded><![CDATA[<p>以下のコマンドでapacheを再起動する。</p>
<pre class="brush: bash;">
/etc/init.d/httpd restart
</pre>
<p>以下のようなメッセージが表示されて再起動できなくなる。</p>
<pre class="brush: bash;">
Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
</pre>
<p>以下のコマンドでポートを使用しているプロセスを調べる。</p>
<pre class="brush: bash;">
/usr/sbin/lsof -i | grep http
</pre>
<p>プロセス番号が表示されるのでkillする。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.justoneplanet.info/2011/08/15/httpd-restart%e3%81%a7address-already-in-use%e3%81%8c%e8%a1%a8%e7%a4%ba%e3%81%95%e3%82%8c%e3%81%9f%e3%81%a8%e3%81%8d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>crontabとCakePHPでバッチ処理をする</title>
		<link>http://blog.justoneplanet.info/2011/08/14/crontab%e3%81%a8cakephp%e3%81%a7%e3%83%90%e3%83%83%e3%83%81%e5%87%a6%e7%90%86%e3%82%92%e3%81%99%e3%82%8b/</link>
		<comments>http://blog.justoneplanet.info/2011/08/14/crontab%e3%81%a8cakephp%e3%81%a7%e3%83%90%e3%83%83%e3%83%81%e5%87%a6%e7%90%86%e3%82%92%e3%81%99%e3%82%8b/#comments</comments>
		<pubDate>Sun, 14 Aug 2011 12:50:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.justoneplanet.info/?p=4300</guid>
		<description><![CDATA[バッチ処理したい時などに使う技である。 ■実装 app/vendors/shells/calc.php 以下のようにしてShellクラスを継承する。基本的にはコントローラと同様にモデルなどが使用できるがコンポーネントにつ [...]]]></description>
			<content:encoded><![CDATA[<p>バッチ処理したい時などに使う技である。</p>
<h3>■実装</h3>
<h4>app/vendors/shells/calc.php</h4>
<p>以下のようにしてShellクラスを継承する。基本的にはコントローラと同様にモデルなどが使用できるがコンポーネントについては注意が必要である。</p>
<pre class="brush: php;">
date_default_timezone_set('Asia/Tokyo');

//Configure::write('Config.environment', isset($_SERVER['CAKE_ENV']) ? $_SERVER['CAKE_ENV'] : &quot;development&quot;);// コマンドラインから叩いている場合、$_SERVERによる環境分岐ができない
Configure::write('Config.environment', &quot;production&quot;);

class RankShell extends Shell
{
    public $uses = array(
        'Logs',
        'Ranks'
    );

    /**
     * 処理を実行する前に読み込むコンポーネントなどを記述する
     */
    public function initialize()
    {
        parent::initialize();
        //$this-&gt;Email = new EmailComponent($this);// コンポーネント名に注意
    }

    /**
     * ここに記述した処理が実行される
     */
    public function main()
    {
        $this-&gt;out(&quot;start&quot;);
        if($result = $this-&gt;Log-&gt;getRank()){
            $this-&gt;Ranks-&gt;deleteAll();
            if($this-&gt;Ranks-&gt;saveAll($result)){
                $this-&gt;out(&quot;success&quot;);
            }
            else{
                $this-&gt;out(&quot;failed to save&quot;);
            }
        }
        else{
            $this-&gt;out(&quot;failed to calc&quot;);
        }
    }
}
</pre>
<h3>■実行</h3>
<p>以下のようにして実行できるかどうか確認する。</p>
<pre class="brush: bash;">
/usr/bin/php /var/www/hogehoge.justoneplanet.info/cake/console/cake.php calc
</pre>
<h3>■crontab</h3>
<p>以下のコマンドを実行してcrontabを編集する。</p>
<pre class="brush: bash;">
crontab -e
</pre>
<p>例えば10時のオヤツを忘れないよう10:15に実行するようにするには以下のようにする。</p>
<pre class="brush: bash;">
15 10 * * * /usr/bin/php /var/www/hogehoge.justoneplanet.info/cake/console/cake.php calc
</pre>
<p>15分ごとに処理をするには以下のように記述する。</p>
<pre class="brush: bash;">
*/15 * * * * /usr/bin/php /var/www/hogehoge.justoneplanet.info/cake/console/cake.php calc
</pre>
<p>以上のようにCakePHPでは非常に簡単にバッチ処理を書くことができる。個人的にはZendFrameworkよりも簡単に感じる。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.justoneplanet.info/2011/08/14/crontab%e3%81%a8cakephp%e3%81%a7%e3%83%90%e3%83%83%e3%83%81%e5%87%a6%e7%90%86%e3%82%92%e3%81%99%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gaucheをインストールする</title>
		<link>http://blog.justoneplanet.info/2011/07/19/gauche%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b/</link>
		<comments>http://blog.justoneplanet.info/2011/07/19/gauche%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b/#comments</comments>
		<pubDate>Tue, 19 Jul 2011 04:38:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.justoneplanet.info/?p=4375</guid>
		<description><![CDATA[yum install gcc make wget http://prdownloads.sourceforge.net/gauche/Gauche-0.9.1.tgz tar xvzf Gauche-0.9.1.tgz [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash;">
yum install gcc make
wget http://prdownloads.sourceforge.net/gauche/Gauche-0.9.1.tgz
tar xvzf Gauche-0.9.1.tgz
cd Gauche-0.9.1
./configure
make
make install
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.justoneplanet.info/2011/07/19/gauche%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pywebsocketをインストールする</title>
		<link>http://blog.justoneplanet.info/2011/04/10/pywebsocket%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b/</link>
		<comments>http://blog.justoneplanet.info/2011/04/10/pywebsocket%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b/#comments</comments>
		<pubDate>Sun, 10 Apr 2011 13:25:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[サーバーサイド]]></category>

		<guid isPermaLink="false">http://blog.justoneplanet.info/?p=3949</guid>
		<description><![CDATA[■pywebsocket単体で動作させる draft75 vi /home/pywebsocket-0.5.2/src/mod_pywebsocket/standalone.py 以下の部分を parser.add_op [...]]]></description>
			<content:encoded><![CDATA[<h3>■pywebsocket単体で動作させる</h3>
<h4>draft75</h4>
<pre class="brush: bash;">
vi /home/pywebsocket-0.5.2/src/mod_pywebsocket/standalone.py
</pre>
<p>以下の部分を</p>
<pre class="brush: python;">
parser.add_option('--allow-draft75', dest='allow_draft75',
                      action='store_true', default=False,
                      help='Allow draft 75 handshake')
</pre>
<p>以下のように変更する。</p>
<pre class="brush: python;">
parser.add_option('--allow-draft75', dest='allow_draft75',
                      action='store_true', default=True,
                      help='Allow draft 75 handshake')
</pre>
<h4>起動</h4>
<pre class="brush: bash;">
python /home/pywebsocket-0.5.2/src/mod_pywebsocket/standalone.py -p 8800 -d /home/pywebsocket-0.5.2/src/example
</pre>
<p>WebSocketで8800ポートにアクセスする。(●´ω｀●)</p>
<h3>■apacheモジュールとして動作させる</h3>
<h4>http-devel</h4>
<pre class="brush: bash;">
yum install http-devel
</pre>
<h4>mod_python</h4>
<pre class="brush: bash;">
wget http://archive.apache.org/dist/httpd/modpython/mod_python-3.3.1.tgz
tar xvzf mod_python-3.3.1.tgz
cd mod_python-3.3.1
./configure –with-apxs=/usr/sbin/apxs –with-python=/usr/bin/python
make
make install
</pre>
<h5>設定</h5>
<pre class="brush: bash;">
vi /etc/httpd/conf.d/python.conf
</pre>
<p>以下の記述の下に</p>
<pre class="brush: bash;">
LoadModule python_module modules/mod_python.so
</pre>
<p>以下の記述を付加する。</p>
<pre class="brush: bash;">
AddHandler mod_python .py
</pre>
<h4>mod_pywebsocket</h4>
<pre class="brush: bash;">
wget http://pywebsocket.googlecode.com/files/mod_pywebsocket-0.5.2.tar.gz
tar xvzf mod_pywebsocket-0.5.2
cd pywebsocket-0.5.2/src
python setup.py build
python setup.py install
</pre>
<h5>設定</h5>
<pre class="brush: bash;">
vi /etc/httpd/conf.d/python_mod_pywebsocket.conf
</pre>
<p>以下を記述する。</p>
<pre class="brush: xml;">
&lt;IfModule python_module&gt;
    PythonPath &quot;sys.path+['/usr/lib/python2.4/site-packages/']&quot;
    PythonOption mod_pywebsocket.handler_root /var/www/html/wsh
    PythonHeaderParserHandler mod_pywebsocket.headerparserhandler
    PythonOption mod_pywebsocket.allow_draft75 On
&lt;/IfModule&gt;
</pre>
<pre class="brush: bash;">
/etc/init.d/httpd restart
</pre>
<h4>起動</h4>
<pre class="brush: bash;">
cp /home/pywebsocket-0.5.2/src/example/echo_wsh.py /var/www/html/wsh/
</pre>
<p>WebSocketクライアントで/echoにアクセスする。(●´ω｀●)</p>
<h3>■ベンチマーク</h3>
<p>正確性は微妙だが100クライアントからの接続でのロードアベレージは、「node : pywebsoket(standalone) : pywebsoket(apache) = 0.15 : 0.25 : 0.8」となった。最初の2つの差は微妙だったが、Apacheモジュールとして動作させた時のリソースの消費量は明らかに大きいようだ。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.justoneplanet.info/2011/04/10/pywebsocket%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amazon EC2を使ってWebSocketサーバを10分でたてる</title>
		<link>http://blog.justoneplanet.info/2011/04/03/amazon-ec2%e3%81%a7websocket%e3%82%b5%e3%83%bc%e3%83%90%e3%82%9210%e5%88%86%e3%81%a7%e3%81%9f%e3%81%a6%e3%82%8b/</link>
		<comments>http://blog.justoneplanet.info/2011/04/03/amazon-ec2%e3%81%a7websocket%e3%82%b5%e3%83%bc%e3%83%90%e3%82%9210%e5%88%86%e3%81%a7%e3%81%9f%e3%81%a6%e3%82%8b/#comments</comments>
		<pubDate>Sun, 03 Apr 2011 13:51:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.justoneplanet.info/?p=3940</guid>
		<description><![CDATA[前回に引き続きWebSocketサーバをたてる。今回はAmazon EC2を使用する。 sudo passwd root ■インストール rootのパスワードを設定したら以下のコマンドを実行する。 su yum inst [...]]]></description>
			<content:encoded><![CDATA[<p>前回に引き続きWebSocketサーバをたてる。今回はAmazon EC2を使用する。</p>
<pre class="brush: bash;">
sudo passwd root
</pre>
<h3>■インストール</h3>
<p>rootのパスワードを設定したら以下のコマンドを実行する。</p>
<pre class="brush: bash;">
su
yum install openssl-devel gcc-c++ make
wget http://nodejs.org/dist/node-v0.4.3.tar.gz
tar xvzf node-v0.4.3.tar.gz
cd node-v0.4.3
./configure
make
make install
curl http://npmjs.org/install.sh | sh
npm install websocket-server
npm install base64
</pre>
<p>使用しているインスタンスによって、makeは時間がかかるので10分では無理。(๑°⌓°๑)</p>
<section class="kakomi">
<h4>別解1</h4>
<p>以下のようにnaveを使ってインストールする手法もある。</p>
<pre class="brush: bash;">
su
yum install openssl-devel gcc-c++ git make
git clone https://github.com/isaacs/nave.git ~/.nave
~/.nave/nave.sh install latest
~/.nave/nave.sh use latest
echo &quot;~/.nave/nave.sh use latest&quot; &gt;&gt; ~/.bash_profile
curl http://npmjs.org/install.sh | sh
npm install websocket-server
npm install base64
</pre>
<p>残念ながらmicroインスタンスでコンパイルすると負荷が高すぎて途中終了してしまった。Largeでコンパイルすればサクっと終わる。</p>
<h5>追記</h5>
<p>会社で同僚に教えてもらった。</p>
<ul>
<li><a href="https://github.com/isaacs/nave/issues/10">nave unable to build node on Ubuntu 10.04 &#8211; g++ dies</a></li>
</ul>
<h4>別解2</h4>
<p>nvmを使えばnpmも同時にインストールできる。</p>
<pre class="brush: bash;">
su
yum install openssl-devel gcc-c++ git make
git clone git://github.com/creationix/nvm.git ~/.nvm
source ~/.nvm/nvm.sh
echo &quot;~/.nvm/nvm.sh&quot; &gt;&gt; ~/.bash_profile
echo &quot;nvm use v0.4.8&quot; &gt;&gt; ~/.bash_profile
nvm sync
nvm install v0.4.8
npm install websocket-server
npm install base64
</pre>
<p>smallインスタンスたどコンパイルに時間がかかる。</p>
</section>
<h3>■アカウントの作成</h3>
<p>話が前後するがアカウントの作成からだと流石に10分は無理。作成方法については以下を参照すると良い。</p>
<ul>
<li><a href="http://codezine.jp/article/detail/3137">第1回 「AWSの概要と登録手順　～Amazon EC2/S3環境構築のすべて～」</a></li>
<li><a href="http://codezine.jp/article/detail/3232">第2回 「Amazon S3を使いこなしてみよう　～Amazon EC2/S3環境構築のすべて～」</a></li>
<li><a href="http://codezine.jp/article/detail/3325">第3回 「Amazon EC2を動かしてみよう　～Amazon EC2/S3環境構築のすべて～」</a></li>
<li><a href="http://codezine.jp/article/detail/3378">第4回 「Amazon EC2を実践的に使ってみよう　～Amazon EC2/S3環境構築のすべて～」</a></li>
</ul>
<h3>■EC2まとめ</h3>
<p>コマンドラインツールを使用するにはX.509 証明書が必要。基本的にはコントロールパネルから操作が可能。インスタンスを起動させるフローで証明書（鍵）がダウンロードできる。SSHはその鍵で接続する。そんな感じ。(｡･ω･)ﾉﾞ</p>
<h3>■開発環境構築</h3>
<p>以下のコマンドを実行しツールをインストールする。</p>
<pre class="brush: bash;">
npm install node-dev #ファイルを変更すると再実行
npm install node-inspector #Developer Tool
npm install cloud9 #IDE
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.justoneplanet.info/2011/04/03/amazon-ec2%e3%81%a7websocket%e3%82%b5%e3%83%bc%e3%83%90%e3%82%9210%e5%88%86%e3%81%a7%e3%81%9f%e3%81%a6%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>さくらのVPSを10分でWebSocketサーバにする</title>
		<link>http://blog.justoneplanet.info/2011/03/23/%e3%81%95%e3%81%8f%e3%82%89%e3%81%aevps%e3%82%9210%e5%88%86%e3%81%a7websocket%e3%82%b5%e3%83%bc%e3%83%90%e3%81%ab%e3%81%99%e3%82%8b/</link>
		<comments>http://blog.justoneplanet.info/2011/03/23/%e3%81%95%e3%81%8f%e3%82%89%e3%81%aevps%e3%82%9210%e5%88%86%e3%81%a7websocket%e3%82%b5%e3%83%bc%e3%83%90%e3%81%ab%e3%81%99%e3%82%8b/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 15:28:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.justoneplanet.info/?p=3934</guid>
		<description><![CDATA[たぶん10分くらいで可能。 yum install openssl-devel wget http://nodejs.org/dist/node-v0.4.3.tar.gz tar xvzf node-v0.4.3.ta [...]]]></description>
			<content:encoded><![CDATA[<p>たぶん10分くらいで可能。</p>
<pre class="brush: bash;">
yum install openssl-devel
wget http://nodejs.org/dist/node-v0.4.3.tar.gz
tar xvzf node-v0.4.3.tar.gz
cd node-v0.4.3
./configure
make
make install
curl http://npmjs.org/install.sh | sh
npm install websocket-server
npm install base64
</pre>
<p>make中は一休みできる(●´ω｀●)</p>
<section class="kakomi">
<h4>最新版</h4>
<p>websocket-serverは新しいWebSocketの仕様に対応してないのでwebsocketを使用する。</p>
<pre class="brush: bash;">
yum install openssl-devel gcc-c++ make
wget http://nodejs.org/dist/v0.6.8/node-v0.6.8.tar.gz
tar xvzf node-v0.6.8.tar.gz
cd node-v0.6.8
./configure
make
make install
curl http://npmjs.org/install.sh | sh
npm install websocket
</pre>
</section>
]]></content:encoded>
			<wfw:commentRss>http://blog.justoneplanet.info/2011/03/23/%e3%81%95%e3%81%8f%e3%82%89%e3%81%aevps%e3%82%9210%e5%88%86%e3%81%a7websocket%e3%82%b5%e3%83%bc%e3%83%90%e3%81%ab%e3%81%99%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

