<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>내 맘대로 보는 세상 &#187; unix</title>
	<atom:link href="http://b.mytears.org/tag/unix/feed" rel="self" type="application/rss+xml" />
	<link>http://b.mytears.org</link>
	<description>평범한 일상 속의 보석찾기..</description>
	<lastBuildDate>Sat, 19 Jun 2010 11:27:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>작은 것이 아름답다.</title>
		<link>http://b.mytears.org/2009/04/1903</link>
		<comments>http://b.mytears.org/2009/04/1903#comments</comments>
		<pubDate>Wed, 08 Apr 2009 08:34:21 +0000</pubDate>
		<dc:creator>정태영</dc:creator>
				<category><![CDATA[Tae-young]]></category>
		<category><![CDATA[connection]]></category>
		<category><![CDATA[mesh up]]></category>
		<category><![CDATA[pipe]]></category>
		<category><![CDATA[simple is beautiful]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://b.mytears.org/?p=1903</guid>
		<description><![CDATA[<p>&#8216;작은 것이 아름답다.&#8217;라는 말을 들어보셨나요? &#8216;Simple is beautiful&#8217; 이라는 유닉스 철학인데, 요새 매쉬업이라는 개념을 보고 있으면 바로 이 말이 떠오르곤 합니다.</p>
<p>유닉스 철학 중에는 &#8216;출력이 다른 프로그램의 인풋으로 사용될 수 있다고 예상하라. (Expect the output of every program to become the input to another, as yet unknown, program.)&#8217; 라는 항목이 있습니다. 파이프 라는 말을 들어보셨을지 모르겠지만 ...</p>
<p><a href='http://b.mytears.org/2009/04/1903'>Read the rest of this entry...</a></p>
<p><h3 style="clear:both;">Related Posts</h3><ul class="related_post"><li>1/14/2009 -- <a href="http://b.mytears.org/2009/01/848" title="대칭키를 이용한 ssh 로그인 for Mac/*nix">대칭키를 이용한 ssh 로그인 for Mac/*nix (0)</a></li><li>1/31/2008 -- <a href="http://b.mytears.org/2008/01/623" title="problem in fastcgi with apache">problem in fastcgi with apache (2)</a></li><li>10/24/2007 -- <a href="http://b.mytears.org/2007/10/609" title="sql injection 을 피하기위한 간단한 방법&#8230;">sql injection 을 피하기위한 간단한 방법&#8230; (2)</a></li><li>1/2/2007 -- <a href="http://b.mytears.org/2007/01/477" title="아파치 안전 장치&#8230;">아파치 안전 장치&#8230; (1)</a></li><li>10/19/2006 -- <a href="http://b.mytears.org/2006/10/442" title="새 백업 스크립트&#8230;">새 백업 스크립트&#8230; (1)</a></li></ul></p><div style="width: 180px; margin-left: auto; margin-right: auto; margin-bottom: 30px; margin-top: 30px; ">
    <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='73' height='79' align='left' style="border-bottom: 1px solid #CFD4DA; border-right: 1px solid #CFD4DA;">
    <param name='allowScriptAccess' value='always'/>
    <param name='movie' value='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F%3Fp%3D1903&rdate=2009-04-08+17%3A34%3A21&rawhtml=&skin=1&showhitcnt=1&platform=5'/>
    <param name='quality' value='high'/>
    <param name='wmode' value='window'/>
    <embed src='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F%3Fp%3D1903&rdate=2009-04-08+17%3A34%3A21&rawhtml=&skin=1&showhitcnt=1&platform=5' quality='high' wmode='window' width='73' height='79' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>
    </object>
		</div>]]></description>
			<content:encoded><![CDATA[<p>&#8216;작은 것이 아름답다.&#8217;라는 말을 들어보셨나요? &#8216;Simple is beautiful&#8217; 이라는 <a href="http://www.faqs.org/docs/artu/ch01s06.html">유닉스 철학</a>인데, 요새 매쉬업이라는 개념을 보고 있으면 바로 이 말이 떠오르곤 합니다.</p>
<p>유닉스 철학 중에는 &#8216;출력이 다른 프로그램의 인풋으로 사용될 수 있다고 예상하라. (Expect the output of every program to become the input to another, as yet unknown, program.)&#8217; 라는 항목이 있습니다. 파이프 라는 말을 들어보셨을지 모르겠지만 이를 이용하면 다른 프로그램의 출력을 내 프로그램의 입력으로 받아 사용할 수 있기 때문에 복잡한 프로그램을 만들기보다는 <em>간단한</em> 프로그램을 만들고, 이미 만들어져있는 프로그램들과 조합을 해서 사용하는 것이 가능해집니다.</p>
<p><span id="more-1903"></span>예를 들어봅시다. A 란 파일에는 이름들이 리스트되어 있습니다. 이 파일의 내용을 확인하기 위해서 cat 을 사용해봅시다.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1903code4'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p19034"><td class="code" id="p1903code4"><pre class="sh" style="font-family:monospace;">cat A</pre></td></tr></table></div>

<p>파일의 내용이 정렬되어 있지 않기 때문에 내용을 확인하는게 쉽지 않습니다. 하지만 이름들을 정렬시키는 일은 얼운 게 아닙니다. 출력을 pipe(|)를 이용해서 sort 로 넘겨주면 되거든요.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1903code5'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p19035"><td class="code" id="p1903code5"><pre class="sh" style="font-family:monospace;">cat A | sort</pre></td></tr></table></div>

<p>cat 은 A의 내용을 읽어 표준출력(stdout)으로 출력하고 파이프는 cat의 표준 출력을 sort의 표준 입력으로 연결해줍니다. sort는 표준 입력에서 값을 읽어들인 뒤 이 값들을 정렬해서 다시 표준 출력으로 출력해주게 됩니다.</p>
<p>값을 정렬해놓고 보니 동일한 이름이 여러번 입력되있는 것을 확인할 수 있었습니다. 중복된 값을 제거하기 위해 uniq를 이용해봅시다.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1903code6'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p19036"><td class="code" id="p1903code6"><pre class="sh" style="font-family:monospace;">cat A|sort|uniq</pre></td></tr></table></div>

<p>cat, sort, uniq 프로그램은 아주 간단한 동작 만을 담당하고 있지만 이 프로그램들을 조합하니 많은 일을 할 수 있게 되었습니다. 자 그럼 매쉬업은 어떨까요?</p>
<p>지도를 제 홈페이지에 추가해보고 싶었습니다. openAPI를 사용하여 지도를 제 홈페이지에 삽입했습니다. </p>
<p>제가 오늘 들렸던 곳들을 입력받아 지도에 표시하고 싶어졌습니다. openAPI를 사용하여 지도를 제 홈페이지에 삽입하고, 여기에 제가 오늘 있었던 곳을 출력합니다.</p>
<p>오늘 들렀던 곳에서 찍은 사진들을 flikr에 올려두었는데, 이 사진들을 이 지도에서 볼 수 있는 기능을 추가하고 싶어졌습니다. flikr의 openAPI를 이용해서 좀 전에 만들어놨던 프로그램을 확장합니다.</p>
<p>제가 아는 openAPI 서비스들이 많지 않아서 복잡한 예를 들 수가 없네요. 어쨌든 파이프를 이용하느냐 아니면  http, xml, json, ajax를 이용하느냐의 차이가 있을 뿐 비슷하지 않나요. ;)</p><div style="width: 180px; margin-left: auto; margin-right: auto; margin-bottom: 30px; margin-top: 30px; ">
    <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='73' height='79' align='left' style="border-bottom: 1px solid #CFD4DA; border-right: 1px solid #CFD4DA;">
    <param name='allowScriptAccess' value='always'/>
    <param name='movie' value='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F%3Fp%3D1903&rdate=2009-04-08+17%3A34%3A21&rawhtml=&skin=1&showhitcnt=1&platform=5'/>
    <param name='quality' value='high'/>
    <param name='wmode' value='window'/>
    <embed src='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F%3Fp%3D1903&rdate=2009-04-08+17%3A34%3A21&rawhtml=&skin=1&showhitcnt=1&platform=5' quality='high' wmode='window' width='73' height='79' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>
    </object>
		</div><h3 style="clear:both;">Related Posts</h3><ul class="related_post"><li>1/14/2009 -- <a href="http://b.mytears.org/2009/01/848" title="대칭키를 이용한 ssh 로그인 for Mac/*nix">대칭키를 이용한 ssh 로그인 for Mac/*nix (0)</a></li><li>1/31/2008 -- <a href="http://b.mytears.org/2008/01/623" title="problem in fastcgi with apache">problem in fastcgi with apache (2)</a></li><li>10/24/2007 -- <a href="http://b.mytears.org/2007/10/609" title="sql injection 을 피하기위한 간단한 방법&#8230;">sql injection 을 피하기위한 간단한 방법&#8230; (2)</a></li><li>1/2/2007 -- <a href="http://b.mytears.org/2007/01/477" title="아파치 안전 장치&#8230;">아파치 안전 장치&#8230; (1)</a></li><li>10/19/2006 -- <a href="http://b.mytears.org/2006/10/442" title="새 백업 스크립트&#8230;">새 백업 스크립트&#8230; (1)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://b.mytears.org/2009/04/1903/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>대칭키를 이용한 ssh 로그인 for Mac/*nix</title>
		<link>http://b.mytears.org/2009/01/848</link>
		<comments>http://b.mytears.org/2009/01/848#comments</comments>
		<pubDate>Tue, 13 Jan 2009 17:03:30 +0000</pubDate>
		<dc:creator>정태영</dc:creator>
				<category><![CDATA[Tae-young]]></category>
		<category><![CDATA[dsa]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[keychain]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[pair]]></category>
		<category><![CDATA[rsa]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ssh-agent]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://b.mytears.org/?p=848</guid>
		<description><![CDATA[<p>ssh 프로토콜의 인증 방법은 매우 다양하며 많이 쓰이는 방식은 다음 정도가 되겠습니다.</p>
<p></p>
<p></p>
<p>RSA or DSA key pair</p>
<p>keyboard-interactive</p>
<p>password</p>
<p></p>
<p></p>
<p>이 중 keyboard-interactive / password 인증 방식은 전부 비밀번호를 이용한 인증이고, RSA/DSA 방식은 대칭키(공개키 &#8211; 비밀키)를 이용하는 방식입니다. 공개키를 등록만 해두면 여러 개의 서버에 접속할 때 각기 따로 비밀번호를 치고 로그인을 할 필요가 없으므로 매우 편리한 방식이 되겠습니다.</p>
<p>참고로 비밀키를 도둑맞을 ...</p>
<p><a href='http://b.mytears.org/2009/01/848'>Read the rest of this entry...</a></p>
<p><h3 style="clear:both;">Related Posts</h3><ul class="related_post"><li>4/4/2010 -- <a href="http://b.mytears.org/2010/04/2192" title="지멋대로의 영어를 더 자주 볼 수 있었음 좋겠습니다.">지멋대로의 영어를 더 자주 볼 수 있었음 좋겠습니다. (5)</a></li><li>12/15/2009 -- <a href="http://b.mytears.org/2009/12/2105" title="MySQL의 라이센스 모델이 가지는 의미는? MySQL은 결국 죽임을 당할 것인가? ">MySQL의 라이센스 모델이 가지는 의미는? MySQL은 결국 죽임을 당할 것인가?  (0)</a></li><li>8/25/2009 -- <a href="http://b.mytears.org/2009/08/2074" title="사라져가는 오픈소스 커뮤니티?">사라져가는 오픈소스 커뮤니티? (7)</a></li><li>4/10/2009 -- <a href="http://b.mytears.org/2009/04/1926" title="Gentoo에서 fail2ban 쓰기">Gentoo에서 fail2ban 쓰기 (2)</a></li><li>4/9/2009 -- <a href="http://b.mytears.org/2009/04/1912" title="제로보드 XE 관련 약간의 해명&#8230;">제로보드 XE 관련 약간의 해명&#8230; (1)</a></li></ul></p><div style="width: 180px; margin-left: auto; margin-right: auto; margin-bottom: 30px; margin-top: 30px; ">
    <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='73' height='79' align='left' style="border-bottom: 1px solid #CFD4DA; border-right: 1px solid #CFD4DA;">
    <param name='allowScriptAccess' value='always'/>
    <param name='movie' value='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F%3Fp%3D848&rdate=2009-01-14+02%3A03%3A30&rawhtml=&skin=1&showhitcnt=1&platform=5'/>
    <param name='quality' value='high'/>
    <param name='wmode' value='window'/>
    <embed src='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F%3Fp%3D848&rdate=2009-01-14+02%3A03%3A30&rawhtml=&skin=1&showhitcnt=1&platform=5' quality='high' wmode='window' width='73' height='79' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>
    </object>
		</div>]]></description>
			<content:encoded><![CDATA[<p>ssh 프로토콜의 인증 방법은 매우 다양하며 많이 쓰이는 방식은 다음 정도가 되겠습니다.</p>
<blockquote>
<ol>
<li>RSA or DSA key pair</li>
<li>keyboard-interactive</li>
<li>password</li>
</ol>
</blockquote>
<p>이 중 keyboard-interactive / password 인증 방식은 전부 비밀번호를 이용한 인증이고, RSA/DSA 방식은 대칭키(공개키 &#8211; 비밀키)를 이용하는 방식입니다. 공개키를 등록만 해두면 여러 개의 서버에 접속할 때 각기 따로 비밀번호를 치고 로그인을 할 필요가 없으므로 매우 편리한 방식이 되겠습니다.</p>
<p><span id="more-848"></span>참고로 비밀키를 도둑맞을 때를 대비해서 비밀키에 암호를 걸어둘 수도 있습니다.</p>
<p>대칭키를 이용해서 로그인을 하도록 설정하려면 우선 대칭키를 만들어야 합니다. 대칭키를 만드는데는 ssh-keygen 이라는 툴에 어떤 방식의 암호화를 사용할 건지만 가르쳐주면 됩니다. </p>
<blockquote><p>
# ssh-keygen -t rsa<br />
# ssh-keygen -t dsa
</p></blockquote>
<p>위 명령어 중 위에껄 사용하면 rsa 키가 만들어지고, 아래껄 사용하면 dsa 키가 만들어집니다. 중간에 비밀번호를 입력하라고 나오는데, 여기서 비밀번호를 입력하게 되면 그 비밀번호를 이용해서 키를 암호화 를 해놓게 됩니다. (나중에 그 키를 사용하기 위해 비밀번호를 입력해야 합니다.)</p>
<p>키를 ssh 서버에 등록하려면 서버의 ~/.ssh/authorized_keys 파일에다가 아까 생성한 공개키 파일(id_rsa.pub or id_dsa.pub)의 내용을 적어주기만 하면 됩니다. 간단하죠.</p>
<p>만약 키에 암호를 걸지 않았다면 지금 상태만으로도 아무 문제 없이 사용할 수 있지만! 키에 암호를 걸어놓았을 경우 ssh로 접속을 시도할 때마다 비밀키를 읽어오기 위해 비밀번호를 물어볼 것입니다. 비밀번호를 치는게 귀찮아서 대칭키 기반 로그인을 설정한건데 이러면 의미가 없겠죠!</p>
<p>이럴 때 유용하게 써먹을 수 있는게 바로  ssh-agent입니다. 비밀키를 불러들이면, 세션이 끝날 때까지 비밀키를 계속 써먹을 수 있도록 도와주는 개념이 되겠습니다. 터미널을 닫지만 않으면 그 세션 내에서는 한 번 로딩한 비밀키를 계속해서 우려먹는거죠.</p>
<blockquote><p># eval `ssh-agent`<br />
# ssh-add ~/.ssh/id_rsa</p></blockquote>
<p>사용법은 위와 같은데, 여기에 약간의 문제가 있습니다. 새로운 터미널을 연다거나 터미널을 닫았다가 다시 실행시키는 경우엔 비밀키를 새로 로딩해야 하거든요. 아까보단 많이 편해졌지만 그래도 좀 귀찮죠?</p>
<p>하지만 걱정하실 필요는 없습니다. 이미 발빠른 아저씨들이 <a href="http://www.gentoo.org/proj/en/keychain/index.xml">keychain</a>을 만들었거든요. keychain을 이용할 경우 이미 로딩된 키가 있는지를 확인하고 로딩된 키가 발견되면 그걸 공유하게 되므로 처음 맥/PC를 켜서 한 번만 키를 로딩하게 되면 세션을 몇 번이나 열고 닫든 상관없이 계속해서 이 키를 공유하게 되니 아주 편리하죠.</p>
<blockquote><p>### In Gentoo Linux<br />
# emerge keychain</p>
<p>### in Mac OS X<br />
# sudo port install keychain</p>
<p># echo &#8220;/usr/bin/keychain ~/.ssh/id_rsa&#8221; >> ~/.bash_profile<br />
# echo &#8220;source ~/.keychain/`hostname`-sh > /dev/null&#8221; >> ~/.bash_profile
</p></blockquote>
<p>사용법은 위와 같습니다. Mac OS X 사용자들은 macports를 이용하면 되고, gentoo linux라면 emerge를 이용하면 되겠습니다. </p>
<p>참고자료:<br />
<a href="http://www-128.ibm.com/developerworks/library/l-keyc.html">OpenSSH key management, Part 1</a><br />
<a href="http://www-128.ibm.com/developerworks/library/l-keyc2/">OpenSSH key management, Part 2</a><br />
<a href="http://www-128.ibm.com/developerworks/linux/library/l-keyc3/">OpenSSH key management, Part 3</a></p>
<p><a href="http://www-128.ibm.com/developerworks/kr/linux/library/l-keyc.html">OpenSSH key management, Part 1 번역판</a><br />
<a href="http://www-128.ibm.com/developerworks/kr/library/l-keyc2/">OpenSSH key management, Part 2 번역판</a></p><div style="width: 180px; margin-left: auto; margin-right: auto; margin-bottom: 30px; margin-top: 30px; ">
    <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='73' height='79' align='left' style="border-bottom: 1px solid #CFD4DA; border-right: 1px solid #CFD4DA;">
    <param name='allowScriptAccess' value='always'/>
    <param name='movie' value='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F%3Fp%3D848&rdate=2009-01-14+02%3A03%3A30&rawhtml=&skin=1&showhitcnt=1&platform=5'/>
    <param name='quality' value='high'/>
    <param name='wmode' value='window'/>
    <embed src='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F%3Fp%3D848&rdate=2009-01-14+02%3A03%3A30&rawhtml=&skin=1&showhitcnt=1&platform=5' quality='high' wmode='window' width='73' height='79' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>
    </object>
		</div><h3 style="clear:both;">Related Posts</h3><ul class="related_post"><li>4/4/2010 -- <a href="http://b.mytears.org/2010/04/2192" title="지멋대로의 영어를 더 자주 볼 수 있었음 좋겠습니다.">지멋대로의 영어를 더 자주 볼 수 있었음 좋겠습니다. (5)</a></li><li>12/15/2009 -- <a href="http://b.mytears.org/2009/12/2105" title="MySQL의 라이센스 모델이 가지는 의미는? MySQL은 결국 죽임을 당할 것인가? ">MySQL의 라이센스 모델이 가지는 의미는? MySQL은 결국 죽임을 당할 것인가?  (0)</a></li><li>8/25/2009 -- <a href="http://b.mytears.org/2009/08/2074" title="사라져가는 오픈소스 커뮤니티?">사라져가는 오픈소스 커뮤니티? (7)</a></li><li>4/10/2009 -- <a href="http://b.mytears.org/2009/04/1926" title="Gentoo에서 fail2ban 쓰기">Gentoo에서 fail2ban 쓰기 (2)</a></li><li>4/9/2009 -- <a href="http://b.mytears.org/2009/04/1912" title="제로보드 XE 관련 약간의 해명&#8230;">제로보드 XE 관련 약간의 해명&#8230; (1)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://b.mytears.org/2009/01/848/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>problem in fastcgi with apache</title>
		<link>http://b.mytears.org/2008/01/623</link>
		<comments>http://b.mytears.org/2008/01/623#comments</comments>
		<pubDate>Thu, 31 Jan 2008 04:46:34 +0000</pubDate>
		<dc:creator>정태영</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Unfix]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[fastcgi]]></category>
		<category><![CDATA[mod_fcgid]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://b.mytears.org/2008/01/623</guid>
		<description><![CDATA[<p>현재 unfix 서버에는 apache + mod_fcgid 환경에서 fastcgi 를 지원하고 있다. 그런데 fastcgi 를 적용시킨 후 가끔 apache 가 먹통이 되는 현상이 생겨버렸다.</p>
<p>대부분의 apache 프로세스가 D state 를 가지게 되면서 더 이상 프로세스를 만들어내지 못하게 되서 요청을 처리하지 못하게 되는 것 같은데, D state 는 Uninterruptible sleep 을 의미하므로 fastcgi 프로세스에서 interrupt 를 disable 시킨채로 ...</p>
<p><a href='http://b.mytears.org/2008/01/623'>Read the rest of this entry...</a></p>
<p><h3 style="clear:both;">Related Posts</h3><ul class="related_post"><li>1/2/2007 -- <a href="http://b.mytears.org/2007/01/477" title="아파치 안전 장치&#8230;">아파치 안전 장치&#8230; (1)</a></li><li>10/19/2006 -- <a href="http://b.mytears.org/2006/10/442" title="새 백업 스크립트&#8230;">새 백업 스크립트&#8230; (1)</a></li><li>4/23/2006 -- <a href="http://b.mytears.org/2006/04/345" title="backup script 도 작성 완료 -_-v">backup script 도 작성 완료 -_-v (2)</a></li><li>8/26/2006 -- <a href="http://b.mytears.org/2006/08/379" title="ErrorDocument 수정">ErrorDocument 수정 (0)</a></li><li>1/23/2009 -- <a href="http://b.mytears.org/2009/01/1192" title="Punbb update">Punbb update (0)</a></li></ul></p><div style="width: 180px; margin-left: auto; margin-right: auto; margin-bottom: 30px; margin-top: 30px; ">
    <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='73' height='79' align='left' style="border-bottom: 1px solid #CFD4DA; border-right: 1px solid #CFD4DA;">
    <param name='allowScriptAccess' value='always'/>
    <param name='movie' value='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2008%2F01%2F623&rdate=2008-01-31+13%3A46%3A34&rawhtml=&skin=1&showhitcnt=1&platform=5'/>
    <param name='quality' value='high'/>
    <param name='wmode' value='window'/>
    <embed src='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2008%2F01%2F623&rdate=2008-01-31+13%3A46%3A34&rawhtml=&skin=1&showhitcnt=1&platform=5' quality='high' wmode='window' width='73' height='79' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>
    </object>
		</div>]]></description>
			<content:encoded><![CDATA[<p>현재 unfix 서버에는 apache + mod_fcgid 환경에서 fastcgi 를 지원하고 있다. 그런데 fastcgi 를 적용시킨 후 가끔 apache 가 먹통이 되는 현상이 생겨버렸다.</p>
<p>대부분의 apache 프로세스가 D state 를 가지게 되면서 더 이상 프로세스를 만들어내지 못하게 되서 요청을 처리하지 못하게 되는 것 같은데, D state 는 Uninterruptible sleep 을 의미하므로 fastcgi 프로세스에서 interrupt 를 disable 시킨채로 sleep 상태에 들어가서 이런 문제가 생기는 것으로 보인다.</p>
<p>그렇다고 하루종일 아파치가 정상적으로 동작하고 있나를 확인할 수는 없기에 스크립트를 하나 작성해봤다.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p623code8'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6238"><td class="code" id="p623code8"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #007800;">cnt</span>=<span style="color: #000000;">0</span>;
<span style="color: #000000; font-weight: bold;">for</span> x <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-C</span> apache2 <span style="color: #660033;">-o</span> <span style="color: #c20cb9; font-weight: bold;">stat</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> D<span style="color: #000000; font-weight: bold;">`</span>;<span style="color: #000000; font-weight: bold;">do</span> 
    <span style="color: #7a0874; font-weight: bold;">let</span> cnt++;
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$cnt</span> <span style="color: #660033;">-ge</span> <span style="color: #000000;">10</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-HUP</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>apache2.pid<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></td></tr></table></div>

<p>sort 와 uniq 를 이용해서 숫자를 셀 수도 있지만 정상적인 경우에 D stat 를 가지는 프로세스가 존재하지 않으므로 for 를 이용하기로 했다. 꺄아! 과연 효과는 -_-! 두둥!</p><div style="width: 180px; margin-left: auto; margin-right: auto; margin-bottom: 30px; margin-top: 30px; ">
    <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='73' height='79' align='left' style="border-bottom: 1px solid #CFD4DA; border-right: 1px solid #CFD4DA;">
    <param name='allowScriptAccess' value='always'/>
    <param name='movie' value='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2008%2F01%2F623&rdate=2008-01-31+13%3A46%3A34&rawhtml=&skin=1&showhitcnt=1&platform=5'/>
    <param name='quality' value='high'/>
    <param name='wmode' value='window'/>
    <embed src='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2008%2F01%2F623&rdate=2008-01-31+13%3A46%3A34&rawhtml=&skin=1&showhitcnt=1&platform=5' quality='high' wmode='window' width='73' height='79' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>
    </object>
		</div><h3 style="clear:both;">Related Posts</h3><ul class="related_post"><li>1/2/2007 -- <a href="http://b.mytears.org/2007/01/477" title="아파치 안전 장치&#8230;">아파치 안전 장치&#8230; (1)</a></li><li>10/19/2006 -- <a href="http://b.mytears.org/2006/10/442" title="새 백업 스크립트&#8230;">새 백업 스크립트&#8230; (1)</a></li><li>4/23/2006 -- <a href="http://b.mytears.org/2006/04/345" title="backup script 도 작성 완료 -_-v">backup script 도 작성 완료 -_-v (2)</a></li><li>8/26/2006 -- <a href="http://b.mytears.org/2006/08/379" title="ErrorDocument 수정">ErrorDocument 수정 (0)</a></li><li>1/23/2009 -- <a href="http://b.mytears.org/2009/01/1192" title="Punbb update">Punbb update (0)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://b.mytears.org/2008/01/623/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>sql injection 을 피하기위한 간단한 방법…</title>
		<link>http://b.mytears.org/2007/10/609</link>
		<comments>http://b.mytears.org/2007/10/609#comments</comments>
		<pubDate>Wed, 24 Oct 2007 13:48:43 +0000</pubDate>
		<dc:creator>정태영</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[array_map]]></category>
		<category><![CDATA[avoid]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql_real_escape_string]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Programing]]></category>
		<category><![CDATA[secure]]></category>
		<category><![CDATA[sql injection]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://b.mytears.org/2007/10/609</guid>
		<description><![CDATA[<p>sql injection 을 피하기 위해 single quote 를 escape 시켜주는 코드를 작성해야할 필요가 있었는데, 매번 하나하나에 대해 mysql_real_escape_string 을 호출해주는 건 너무나도 번거로웠다. 뭔가 간단하게 처리할 방법이 없을까 하고 찾아봤더니 왠걸! array_map 이라는 마법의 함수를 발견할 수 있었다.</p>
<p></p>
<p>?View Code PHPfunction stripslashes_deep&#40;$var&#41;&#123;</p>
<p>    $var = is_array&#40;$var&#41;?</p>
<p>         ...</p>
<p><a href='http://b.mytears.org/2007/10/609'>Read the rest of this entry...</a></p>
<p><h3 style="clear:both;">Related Posts</h3><ul class="related_post"><li>11/15/2005 -- <a href="http://b.mytears.org/2005/11/293" title="나는 제로보드가 싫어요!!">나는 제로보드가 싫어요!! (5)</a></li><li>1/28/2009 -- <a href="http://b.mytears.org/2009/01/1228" title="번역: 한국의 홈브류 인터넷">번역: 한국의 홈브류 인터넷 (0)</a></li><li>1/28/2009 -- <a href="http://b.mytears.org/2009/01/1224" title="인터넷 뱅킹과 크로스 브라우징">인터넷 뱅킹과 크로스 브라우징 (2)</a></li><li>1/23/2009 -- <a href="http://b.mytears.org/2009/01/1192" title="Punbb update">Punbb update (0)</a></li><li>1/31/2008 -- <a href="http://b.mytears.org/2008/01/623" title="problem in fastcgi with apache">problem in fastcgi with apache (2)</a></li></ul></p><div style="width: 180px; margin-left: auto; margin-right: auto; margin-bottom: 30px; margin-top: 30px; ">
    <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='73' height='79' align='left' style="border-bottom: 1px solid #CFD4DA; border-right: 1px solid #CFD4DA;">
    <param name='allowScriptAccess' value='always'/>
    <param name='movie' value='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2007%2F10%2F609&rdate=2007-10-24+22%3A48%3A43&rawhtml=&skin=1&showhitcnt=1&platform=5'/>
    <param name='quality' value='high'/>
    <param name='wmode' value='window'/>
    <embed src='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2007%2F10%2F609&rdate=2007-10-24+22%3A48%3A43&rawhtml=&skin=1&showhitcnt=1&platform=5' quality='high' wmode='window' width='73' height='79' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>
    </object>
		</div>]]></description>
			<content:encoded><![CDATA[<p>sql injection 을 피하기 위해 single quote 를 escape 시켜주는 코드를 작성해야할 필요가 있었는데, 매번 하나하나에 대해 mysql_real_escape_string 을 호출해주는 건 너무나도 번거로웠다. 뭔가 간단하게 처리할 방법이 없을까 하고 찾아봤더니 왠걸! array_map 이라는 마법의 함수를 발견할 수 있었다.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p609code10'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p60910"><td class="code" id="p609code10"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> stripslashes_deep<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$var</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span>?
                  <a href="http://www.php.net/array_map"><span style="color: #990000;">array_map</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'stripslashes_deep'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span>
                  <a href="http://www.php.net/stripslashes"><span style="color: #990000;">stripslashes</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$var</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> mysql_real_escape_string_deep<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$var</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span>?
                  <a href="http://www.php.net/array_map"><span style="color: #990000;">array_map</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mysql_real_escape_string_deep'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span>
                  <a href="http://www.php.net/mysql_real_escape_string"><span style="color: #990000;">mysql_real_escape_string</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$var</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <a href="http://www.php.net/get_magic_quotes_gpc"><span style="color: #990000;">get_magic_quotes_gpc</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
        <span style="color: #000088;">$_POST</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array_map"><span style="color: #990000;">array_map</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'stripslashes_deep'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_POST</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
        <span style="color: #000088;">$_GET</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array_map"><span style="color: #990000;">array_map</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'stripslashes_deep'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_GET</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
    <span style="color: #000088;">$_POST</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array_map"><span style="color: #990000;">array_map</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'mysql_real_escape_string_deep'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_POST</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
    <span style="color: #000088;">$_GET</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array_map"><span style="color: #990000;">array_map</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'mysql_real_escape_string_deep'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>common function 들을 정의해놓은 파일 맨 아래 저 코드를 삽입해버리니 sql injection 따위 이제 두려워할 필요가 없어졌다. 움하하핫!!</p>
<p>p.s) 그냥 array_map 에 stripslashes 나 mysql_real_escape_string 을 사용하게 되면 array 가 넘어온 경우 문제가 생길 수 있어서 약간 수정을 했습니다.</p><div style="width: 180px; margin-left: auto; margin-right: auto; margin-bottom: 30px; margin-top: 30px; ">
    <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='73' height='79' align='left' style="border-bottom: 1px solid #CFD4DA; border-right: 1px solid #CFD4DA;">
    <param name='allowScriptAccess' value='always'/>
    <param name='movie' value='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2007%2F10%2F609&rdate=2007-10-24+22%3A48%3A43&rawhtml=&skin=1&showhitcnt=1&platform=5'/>
    <param name='quality' value='high'/>
    <param name='wmode' value='window'/>
    <embed src='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2007%2F10%2F609&rdate=2007-10-24+22%3A48%3A43&rawhtml=&skin=1&showhitcnt=1&platform=5' quality='high' wmode='window' width='73' height='79' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>
    </object>
		</div><h3 style="clear:both;">Related Posts</h3><ul class="related_post"><li>11/15/2005 -- <a href="http://b.mytears.org/2005/11/293" title="나는 제로보드가 싫어요!!">나는 제로보드가 싫어요!! (5)</a></li><li>1/28/2009 -- <a href="http://b.mytears.org/2009/01/1228" title="번역: 한국의 홈브류 인터넷">번역: 한국의 홈브류 인터넷 (0)</a></li><li>1/28/2009 -- <a href="http://b.mytears.org/2009/01/1224" title="인터넷 뱅킹과 크로스 브라우징">인터넷 뱅킹과 크로스 브라우징 (2)</a></li><li>1/23/2009 -- <a href="http://b.mytears.org/2009/01/1192" title="Punbb update">Punbb update (0)</a></li><li>1/31/2008 -- <a href="http://b.mytears.org/2008/01/623" title="problem in fastcgi with apache">problem in fastcgi with apache (2)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://b.mytears.org/2007/10/609/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>아파치 안전 장치…</title>
		<link>http://b.mytears.org/2007/01/477</link>
		<comments>http://b.mytears.org/2007/01/477#comments</comments>
		<pubDate>Tue, 02 Jan 2007 12:34:25 +0000</pubDate>
		<dc:creator>정태영</dc:creator>
				<category><![CDATA[Tae-young]]></category>
		<category><![CDATA[Unfix]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[watchdog]]></category>

		<guid isPermaLink="false">http://b.mytears.org/2007/01/477</guid>
		<description><![CDATA[<p>요새 아파치가 제 속을 썩이고 있습니다. 아무 로그도 남기지 않고 아파치가 먹통이 되는 일이 간간히 있었는데 왜 그런건지 알 수가 없으니 조치를 취하는게 쉽지가 않네요.</p>
<p>하여튼 원인을 알 수 없는고로! 차선책으로 apache watchdog 스크립트를 만들어 넣었습니다.</p>
<p></p>
<p>?View Code BASH#!/bin/sh</p>
<p>&#160;</p>
<p>TEST_URL=&#34;http://unfix.net/test.html&#34;</p>
<p>&#160;</p>
<p>while &#91;&#91; `/usr/bin/curl -m 5 -s ${TEST_URL}` != &#34;working&#34; &#93;&#93;;do</p>
<p>    /etc/init.d/apache restart</p>
<p>    sleep ...</p>
<p><a href='http://b.mytears.org/2007/01/477'>Read the rest of this entry...</a></p>
<p><h3 style="clear:both;">Related Posts</h3><ul class="related_post"><li>1/31/2008 -- <a href="http://b.mytears.org/2008/01/623" title="problem in fastcgi with apache">problem in fastcgi with apache (2)</a></li><li>10/19/2006 -- <a href="http://b.mytears.org/2006/10/442" title="새 백업 스크립트&#8230;">새 백업 스크립트&#8230; (1)</a></li><li>4/23/2006 -- <a href="http://b.mytears.org/2006/04/345" title="backup script 도 작성 완료 -_-v">backup script 도 작성 완료 -_-v (2)</a></li><li>8/26/2006 -- <a href="http://b.mytears.org/2006/08/379" title="ErrorDocument 수정">ErrorDocument 수정 (0)</a></li><li>1/23/2009 -- <a href="http://b.mytears.org/2009/01/1192" title="Punbb update">Punbb update (0)</a></li></ul></p><div style="width: 180px; margin-left: auto; margin-right: auto; margin-bottom: 30px; margin-top: 30px; ">
    <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='73' height='79' align='left' style="border-bottom: 1px solid #CFD4DA; border-right: 1px solid #CFD4DA;">
    <param name='allowScriptAccess' value='always'/>
    <param name='movie' value='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2007%2F01%2F477&rdate=2007-01-02+21%3A34%3A25&rawhtml=&skin=1&showhitcnt=1&platform=5'/>
    <param name='quality' value='high'/>
    <param name='wmode' value='window'/>
    <embed src='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2007%2F01%2F477&rdate=2007-01-02+21%3A34%3A25&rawhtml=&skin=1&showhitcnt=1&platform=5' quality='high' wmode='window' width='73' height='79' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>
    </object>
		</div>]]></description>
			<content:encoded><![CDATA[<p>요새 아파치가 제 속을 썩이고 있습니다. 아무 로그도 남기지 않고 아파치가 먹통이 되는 일이 간간히 있었는데 왜 그런건지 알 수가 없으니 조치를 취하는게 쉽지가 않네요.</p>
<p>하여튼 원인을 알 수 없는고로! 차선책으로 apache watchdog 스크립트를 만들어 넣었습니다.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p477code12'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p47712"><td class="code" id="p477code12"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #007800;">TEST_URL</span>=<span style="color: #ff0000;">&quot;http://unfix.net/test.html&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</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>curl <span style="color: #660033;">-m</span> <span style="color: #000000;">5</span> <span style="color: #660033;">-s</span> <span style="color: #800000;">${TEST_URL}</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;working&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">do</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>apache restart
    <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">3</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p>대략 위와 같은 코드를 사용했는데 아파치를 죽여놓은 후 스크립트를 실행시킬 경우 정상적으로 아파치를 실행시키는 것으로 보아 잘 작동하는 것 같습니다. 휴~</p>
<p>그래도 한 몇일은 좀 신경써서 지켜봐야겠습니다.</p><div style="width: 180px; margin-left: auto; margin-right: auto; margin-bottom: 30px; margin-top: 30px; ">
    <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='73' height='79' align='left' style="border-bottom: 1px solid #CFD4DA; border-right: 1px solid #CFD4DA;">
    <param name='allowScriptAccess' value='always'/>
    <param name='movie' value='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2007%2F01%2F477&rdate=2007-01-02+21%3A34%3A25&rawhtml=&skin=1&showhitcnt=1&platform=5'/>
    <param name='quality' value='high'/>
    <param name='wmode' value='window'/>
    <embed src='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2007%2F01%2F477&rdate=2007-01-02+21%3A34%3A25&rawhtml=&skin=1&showhitcnt=1&platform=5' quality='high' wmode='window' width='73' height='79' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>
    </object>
		</div><h3 style="clear:both;">Related Posts</h3><ul class="related_post"><li>1/31/2008 -- <a href="http://b.mytears.org/2008/01/623" title="problem in fastcgi with apache">problem in fastcgi with apache (2)</a></li><li>10/19/2006 -- <a href="http://b.mytears.org/2006/10/442" title="새 백업 스크립트&#8230;">새 백업 스크립트&#8230; (1)</a></li><li>4/23/2006 -- <a href="http://b.mytears.org/2006/04/345" title="backup script 도 작성 완료 -_-v">backup script 도 작성 완료 -_-v (2)</a></li><li>8/26/2006 -- <a href="http://b.mytears.org/2006/08/379" title="ErrorDocument 수정">ErrorDocument 수정 (0)</a></li><li>1/23/2009 -- <a href="http://b.mytears.org/2009/01/1192" title="Punbb update">Punbb update (0)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://b.mytears.org/2007/01/477/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>새 백업 스크립트…</title>
		<link>http://b.mytears.org/2006/10/442</link>
		<comments>http://b.mytears.org/2006/10/442#comments</comments>
		<pubDate>Thu, 19 Oct 2006 05:20:08 +0000</pubDate>
		<dc:creator>정태영</dc:creator>
				<category><![CDATA[Tae-young]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Unfix]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://b.mytears.org/2006/10/442</guid>
		<description><![CDATA[<p>예전 스크립트에서는 그냥 특정 사용자에 한해서 백업을 하도록 하고 있었습니다. 하지만 백업의 중요성을 절실히 느끼게 되서, 요번엔 사용자의 계정 사용량을 체크해서 1기가 미만으로 사용을 하고 있다면 자동으로 백업을 하도록 만들었습니다.</p>
<p></p>
<p>?View Code BASH#!/bin/sh</p>
<p>&#160;</p>
<p>TMPWATCH=&#34;/usr/sbin/tmpwatch&#34;</p>
<p>&#160;</p>
<p>cd /home/member</p>
<p>for member in *;do</p>
<p>    if &#91;&#91; -d &#34;${member}&#34; &#93;&#93;;then</p>
<p>&#160;</p>
<p>        # get usage</p>
<p>  ...</p>
<p><a href='http://b.mytears.org/2006/10/442'>Read the rest of this entry...</a></p>
<p><h3 style="clear:both;">Related Posts</h3><ul class="related_post"><li>4/23/2006 -- <a href="http://b.mytears.org/2006/04/345" title="backup script 도 작성 완료 -_-v">backup script 도 작성 완료 -_-v (2)</a></li><li>1/31/2008 -- <a href="http://b.mytears.org/2008/01/623" title="problem in fastcgi with apache">problem in fastcgi with apache (2)</a></li><li>1/2/2007 -- <a href="http://b.mytears.org/2007/01/477" title="아파치 안전 장치&#8230;">아파치 안전 장치&#8230; (1)</a></li><li>2/21/2006 -- <a href="http://b.mytears.org/2006/02/327" title="msn custom imoticon 백업&#8230;">msn custom imoticon 백업&#8230; (0)</a></li><li>1/23/2009 -- <a href="http://b.mytears.org/2009/01/1192" title="Punbb update">Punbb update (0)</a></li></ul></p><div style="width: 180px; margin-left: auto; margin-right: auto; margin-bottom: 30px; margin-top: 30px; ">
    <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='73' height='79' align='left' style="border-bottom: 1px solid #CFD4DA; border-right: 1px solid #CFD4DA;">
    <param name='allowScriptAccess' value='always'/>
    <param name='movie' value='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2006%2F10%2F442&rdate=2006-10-19+14%3A20%3A08&rawhtml=&skin=1&showhitcnt=1&platform=5'/>
    <param name='quality' value='high'/>
    <param name='wmode' value='window'/>
    <embed src='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2006%2F10%2F442&rdate=2006-10-19+14%3A20%3A08&rawhtml=&skin=1&showhitcnt=1&platform=5' quality='high' wmode='window' width='73' height='79' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>
    </object>
		</div>]]></description>
			<content:encoded><![CDATA[<p>예전 스크립트에서는 그냥 특정 사용자에 한해서 백업을 하도록 하고 있었습니다. 하지만 백업의 중요성을 절실히 느끼게 되서, 요번엔 사용자의 계정 사용량을 체크해서 1기가 미만으로 사용을 하고 있다면 자동으로 백업을 하도록 만들었습니다.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p442code14'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p44214"><td class="code" id="p442code14"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #007800;">TMPWATCH</span>=<span style="color: #ff0000;">&quot;/usr/sbin/tmpwatch&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>member
<span style="color: #000000; font-weight: bold;">for</span> member <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">*</span>;<span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${member}</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
&nbsp;
        <span style="color: #666666; font-style: italic;"># get usage</span>
        <span style="color: #007800;">usage</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-s</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${member}</span>&quot;</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $1 }'</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
        <span style="color: #666666; font-style: italic;"># remain only one item</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;/backup/home/<span style="color: #007800;">${member}</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
            <span style="color: #007800;">lastone</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;/backup/home/<span style="color: #007800;">${member}</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">head</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">`</span>
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #ff0000;">&quot;/backup/home/<span style="color: #007800;">${member}</span>/<span style="color: #007800;">${lastone}</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;/backup/home/<span style="color: #007800;">${member}</span>/<span style="color: #007800;">${lastone}</span>&quot;</span>
            <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
            <span style="color: #800000;">${TMPWATCH}</span> <span style="color: #660033;">--mtime</span> <span style="color: #000000;">1</span> <span style="color: #ff0000;">&quot;/backup/home/<span style="color: #007800;">${member}</span>&quot;</span>
        <span style="color: #000000; font-weight: bold;">else</span>
            <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #ff0000;">&quot;/backup/home/<span style="color: #007800;">${member}</span>&quot;</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
        <span style="color: #666666; font-style: italic;"># if usage is less than 1.4GB</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${usage}</span> <span style="color: #660033;">-le</span> <span style="color: #000000;">1400000</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
            <span style="color: #c20cb9; font-weight: bold;">tar</span> cfzp <span style="color: #ff0000;">&quot;/backup/home/<span style="color: #007800;">${member}</span>/<span style="color: #007800;">${member}</span>-<span style="color: #780078;">`date +%y%m%d`</span>.tar.gz&quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${member}</span>&quot;</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p>또한 ls 와 head, tmpwatch 를 이용해서 백업본이 최신 2 개만이 유지되도록 만들어놓았습니다. 만약 타르볼로 묶는데 1시간 이상 걸리는 용량을 아카이빙 하면 문제가 될 수 있습니다. &#8211;;</p><div style="width: 180px; margin-left: auto; margin-right: auto; margin-bottom: 30px; margin-top: 30px; ">
    <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='73' height='79' align='left' style="border-bottom: 1px solid #CFD4DA; border-right: 1px solid #CFD4DA;">
    <param name='allowScriptAccess' value='always'/>
    <param name='movie' value='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2006%2F10%2F442&rdate=2006-10-19+14%3A20%3A08&rawhtml=&skin=1&showhitcnt=1&platform=5'/>
    <param name='quality' value='high'/>
    <param name='wmode' value='window'/>
    <embed src='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2006%2F10%2F442&rdate=2006-10-19+14%3A20%3A08&rawhtml=&skin=1&showhitcnt=1&platform=5' quality='high' wmode='window' width='73' height='79' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>
    </object>
		</div><h3 style="clear:both;">Related Posts</h3><ul class="related_post"><li>4/23/2006 -- <a href="http://b.mytears.org/2006/04/345" title="backup script 도 작성 완료 -_-v">backup script 도 작성 완료 -_-v (2)</a></li><li>1/31/2008 -- <a href="http://b.mytears.org/2008/01/623" title="problem in fastcgi with apache">problem in fastcgi with apache (2)</a></li><li>1/2/2007 -- <a href="http://b.mytears.org/2007/01/477" title="아파치 안전 장치&#8230;">아파치 안전 장치&#8230; (1)</a></li><li>2/21/2006 -- <a href="http://b.mytears.org/2006/02/327" title="msn custom imoticon 백업&#8230;">msn custom imoticon 백업&#8230; (0)</a></li><li>1/23/2009 -- <a href="http://b.mytears.org/2009/01/1192" title="Punbb update">Punbb update (0)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://b.mytears.org/2006/10/442/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>backup script 도 작성 완료 -_-v</title>
		<link>http://b.mytears.org/2006/04/345</link>
		<comments>http://b.mytears.org/2006/04/345#comments</comments>
		<pubDate>Sat, 22 Apr 2006 16:43:41 +0000</pubDate>
		<dc:creator>정태영</dc:creator>
				<category><![CDATA[Unfix]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[tmpwatch]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://b.mytears.org/2006/04/345</guid>
		<description><![CDATA[<p>SCSI HDD 같은 경우야 뭐 오래써도 별 문제가 안생기니까&#8230; 이제 겨우 일년 정도밖에 안 쓴 제 서버 하드를 걱정할 일은 아니지만&#8230; 그래도 세상일은 어떻게 될 지 모르기 때문에&#8230; 귀찮다고 미루고 미루던 백업 스크립트를 작성하게 됐습니다.</p>
<p>shell script 의 고수 분들이야 find 등 도 뭔가 멋지게 쓰고 하는 거 같지만! 전 초보 이기 때문에&#8230; 그냥 3일 이상 ...</p>
<p><a href='http://b.mytears.org/2006/04/345'>Read the rest of this entry...</a></p>
<p><h3 style="clear:both;">Related Posts</h3><ul class="related_post"><li>10/19/2006 -- <a href="http://b.mytears.org/2006/10/442" title="새 백업 스크립트&#8230;">새 백업 스크립트&#8230; (1)</a></li><li>1/31/2008 -- <a href="http://b.mytears.org/2008/01/623" title="problem in fastcgi with apache">problem in fastcgi with apache (2)</a></li><li>1/2/2007 -- <a href="http://b.mytears.org/2007/01/477" title="아파치 안전 장치&#8230;">아파치 안전 장치&#8230; (1)</a></li><li>2/21/2006 -- <a href="http://b.mytears.org/2006/02/327" title="msn custom imoticon 백업&#8230;">msn custom imoticon 백업&#8230; (0)</a></li><li>2/1/2009 -- <a href="http://b.mytears.org/2009/02/1335" title="이미지 썸브네일 새로 빌드하기&#8230;">이미지 썸브네일 새로 빌드하기&#8230; (0)</a></li></ul></p><div style="width: 180px; margin-left: auto; margin-right: auto; margin-bottom: 30px; margin-top: 30px; ">
    <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='73' height='79' align='left' style="border-bottom: 1px solid #CFD4DA; border-right: 1px solid #CFD4DA;">
    <param name='allowScriptAccess' value='always'/>
    <param name='movie' value='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2006%2F04%2F345&rdate=2006-04-23+01%3A43%3A41&rawhtml=&skin=1&showhitcnt=1&platform=5'/>
    <param name='quality' value='high'/>
    <param name='wmode' value='window'/>
    <embed src='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2006%2F04%2F345&rdate=2006-04-23+01%3A43%3A41&rawhtml=&skin=1&showhitcnt=1&platform=5' quality='high' wmode='window' width='73' height='79' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>
    </object>
		</div>]]></description>
			<content:encoded><![CDATA[<p>SCSI HDD 같은 경우야 뭐 오래써도 별 문제가 안생기니까&#8230; 이제 겨우 일년 정도밖에 안 쓴 제 서버 하드를 걱정할 일은 아니지만&#8230; 그래도 세상일은 어떻게 될 지 모르기 때문에&#8230; 귀찮다고 미루고 미루던 백업 스크립트를 작성하게 됐습니다.</p>
<p>shell script 의 고수 분들이야 find 등 도 뭔가 멋지게 쓰고 하는 거 같지만! 전 초보 이기 때문에&#8230; 그냥 3일 이상 지난 파일의 경우엔 tmpwatch 가 정리하도록 처리를 해버렸네요&#8230; 흐흐 </p>
<p>혹시나 제 백업 스크립트가 궁금하신 분들은 more 버튼을 클릭하시길&#8230;<br />
<span id="more-345"></span></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p345code16'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p34516"><td class="code" id="p345code16"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #007800;">TMPWATCH</span>=<span style="color: #ff0000;">&quot;/usr/sbin/tmpwatch&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># echo &quot;Backup some config files&quot;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;/backup/etc&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #ff0000;">&quot;/backup/etc&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>etc
<span style="color: #c20cb9; font-weight: bold;">tar</span> cfzp <span style="color: #ff0000;">&quot;/backup/etc/etc-<span style="color: #780078;">`date +%y%m%d`</span>.tar.gz&quot;</span> \
        apache spamword fstab procmailrc portage make.conf conf.d postfix
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;"># echo &quot;Backup svn repositories...&quot;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;/backup/svn&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #ff0000;">&quot;/backup/svn&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">svn</span>
<span style="color: #000000; font-weight: bold;">for</span> repo <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">*</span>;<span style="color: #000000; font-weight: bold;">do</span>
&nbsp;
        <span style="color: #666666; font-style: italic;"># echo &quot;Try to backup /home/svn/$repo&quot;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #007800;">$repo</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #c20cb9; font-weight: bold;">tar</span> cfzp <span style="color: #ff0000;">&quot;/backup/svn/<span style="color: #007800;">$repo</span>-<span style="color: #780078;">`date +%y%m%d`</span>.tar.gz&quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$repo</span>&quot;</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;"># echo &quot;Backup aqua's home directory&quot;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;/backup/home&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #ff0000;">&quot;/backup/home&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>master
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;aqua&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #c20cb9; font-weight: bold;">tar</span> cfzp <span style="color: #ff0000;">&quot;/backup/home/aqua-<span style="color: #780078;">`date +%y%m%d`</span>.tar.gz&quot;</span> <span style="color: #ff0000;">&quot;aqua&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;"># echo &quot;Backup Mysql databases&quot;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>mysql <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>mysql
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> database <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;show databases&quot;</span><span style="color: #000000; font-weight: bold;">|</span>mysql <span style="color: #660033;">-uIDforBackup</span> -pPassword<span style="color: #000000; font-weight: bold;">`</span>;<span style="color: #000000; font-weight: bold;">do</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$database</span>&quot;</span> == <span style="color: #ff0000;">&quot;Database&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</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;">continue</span>;
        <span style="color: #000000; font-weight: bold;">fi</span>
        mysqldump <span style="color: #660033;">-uIDforBackup</span> <span style="color: #660033;">-pPassword</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$database</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> \
                <span style="color: #ff0000;">&quot;/backup/mysql/<span style="color: #007800;">$database</span>-<span style="color: #780078;">`date +%y%m%d`</span>.sql&quot;</span>
        <span style="color: #c20cb9; font-weight: bold;">gzip</span> <span style="color: #660033;">-f</span> <span style="color: #ff0000;">&quot;/backup/mysql/<span style="color: #007800;">$database</span>-<span style="color: #780078;">`date +%y%m%d`</span>.sql&quot;</span>
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># echo &quot;Remove the archives which didn't be modified during recent 73 hours&quot;</span>
<span style="color: #800000;">${TMPWATCH}</span> <span style="color: #660033;">--mtime</span> <span style="color: #000000;">73</span> <span style="color: #000000; font-weight: bold;">/</span>backup
&nbsp;
<span style="color: #666666; font-style: italic;"># echo &quot;Backup finished...&quot;</span></pre></td></tr></table></div>
<div style="width: 180px; margin-left: auto; margin-right: auto; margin-bottom: 30px; margin-top: 30px; ">
    <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='73' height='79' align='left' style="border-bottom: 1px solid #CFD4DA; border-right: 1px solid #CFD4DA;">
    <param name='allowScriptAccess' value='always'/>
    <param name='movie' value='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2006%2F04%2F345&rdate=2006-04-23+01%3A43%3A41&rawhtml=&skin=1&showhitcnt=1&platform=5'/>
    <param name='quality' value='high'/>
    <param name='wmode' value='window'/>
    <embed src='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2006%2F04%2F345&rdate=2006-04-23+01%3A43%3A41&rawhtml=&skin=1&showhitcnt=1&platform=5' quality='high' wmode='window' width='73' height='79' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>
    </object>
		</div><h3 style="clear:both;">Related Posts</h3><ul class="related_post"><li>10/19/2006 -- <a href="http://b.mytears.org/2006/10/442" title="새 백업 스크립트&#8230;">새 백업 스크립트&#8230; (1)</a></li><li>1/31/2008 -- <a href="http://b.mytears.org/2008/01/623" title="problem in fastcgi with apache">problem in fastcgi with apache (2)</a></li><li>1/2/2007 -- <a href="http://b.mytears.org/2007/01/477" title="아파치 안전 장치&#8230;">아파치 안전 장치&#8230; (1)</a></li><li>2/21/2006 -- <a href="http://b.mytears.org/2006/02/327" title="msn custom imoticon 백업&#8230;">msn custom imoticon 백업&#8230; (0)</a></li><li>2/1/2009 -- <a href="http://b.mytears.org/2009/02/1335" title="이미지 썸브네일 새로 빌드하기&#8230;">이미지 썸브네일 새로 빌드하기&#8230; (0)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://b.mytears.org/2006/04/345/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>vim plugin: close tag</title>
		<link>http://b.mytears.org/2005/09/257</link>
		<comments>http://b.mytears.org/2005/09/257#comments</comments>
		<pubDate>Tue, 13 Sep 2005 07:44:21 +0000</pubDate>
		<dc:creator>정태영</dc:creator>
				<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://b.mytears.org/2005/09/13/vim-plugin-close-tag/</guid>
		<description><![CDATA[<p>언제나 일어나서 뉴스 사이트와 자주 출몰하던 커뮤니티 사이트를 돌고 나면 http://packages.gentoo.org 에 들려서 오늘은 또 어떤 패키지들이 올라왔는지를 살펴보곤 합니다. 그러다가 오늘 또 왕건이 하나를 건졌네요.</p>
<p>closetag 는 vim 에서 html 혹은 xml 문서 작업을 할 때 현재 닫힐 차례인 tag를 ctrl &#8211; 단축키를 통해 간단하게 입력할 수 있도록 도와주는 플러그인 입니다.</p>
<p></p>
<p>&#8216;emerge closetag&#8217; 를 통해 설치를 ...</p>
<p><a href='http://b.mytears.org/2005/09/257'>Read the rest of this entry...</a></p>
<p><h3 style="clear:both;">Related Posts</h3><ul class="related_post"><li>1/29/2009 -- <a href="http://b.mytears.org/2009/01/1236" title="wp-codebox, wp-openid 버그 패치">wp-codebox, wp-openid 버그 패치 (4)</a></li><li>1/28/2009 -- <a href="http://b.mytears.org/2009/01/1228" title="번역: 한국의 홈브류 인터넷">번역: 한국의 홈브류 인터넷 (0)</a></li><li>1/28/2009 -- <a href="http://b.mytears.org/2009/01/1224" title="인터넷 뱅킹과 크로스 브라우징">인터넷 뱅킹과 크로스 브라우징 (2)</a></li><li>1/24/2009 -- <a href="http://b.mytears.org/2009/01/1222" title="블로그 업데이트 완료!">블로그 업데이트 완료! (11)</a></li><li>1/23/2009 -- <a href="http://b.mytears.org/2009/01/1192" title="Punbb update">Punbb update (0)</a></li></ul></p><div style="width: 180px; margin-left: auto; margin-right: auto; margin-bottom: 30px; margin-top: 30px; ">
    <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='73' height='79' align='left' style="border-bottom: 1px solid #CFD4DA; border-right: 1px solid #CFD4DA;">
    <param name='allowScriptAccess' value='always'/>
    <param name='movie' value='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2005%2F09%2F13%2Fvim-plugin-close-tag%2F&rdate=2005-09-13+16%3A44%3A21&rawhtml=&skin=1&showhitcnt=1&platform=5'/>
    <param name='quality' value='high'/>
    <param name='wmode' value='window'/>
    <embed src='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2005%2F09%2F13%2Fvim-plugin-close-tag%2F&rdate=2005-09-13+16%3A44%3A21&rawhtml=&skin=1&showhitcnt=1&platform=5' quality='high' wmode='window' width='73' height='79' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>
    </object>
		</div>]]></description>
			<content:encoded><![CDATA[<p>언제나 일어나서 뉴스 사이트와 자주 출몰하던 커뮤니티 사이트를 돌고 나면 <a href='http://packages.gentoo.org'>http://packages.gentoo.org</a> 에 들려서 오늘은 또 어떤 패키지들이 올라왔는지를 살펴보곤 합니다. 그러다가 오늘 또 왕건이 하나를 건졌네요.</p>
<p>closetag 는 vim 에서 html 혹은 xml 문서 작업을 할 때 현재 닫힐 차례인 tag를 ctrl &#8211; 단축키를 통해 간단하게 입력할 수 있도록 도와주는 플러그인 입니다.</p>
<p><span id="more-257"></span><br />
&#8216;emerge closetag&#8217; 를 통해 설치를 하고 난 다음 vim 을 띄우고 </p>
<blockquote><p>&lt;html&gt; blahblah Ctrl-_</p></blockquote>
<p>를 누르니 마법처럼 &lt;/html&gt; 가 입력됩니다&#8230; self close tag 가 들어갔을 때 정상적으로 동작을 할까 싶어서 테스트를 해봤더니&#8230;</p>
<blockquote><p>&lt;html&gt; blahblah &lt;img /&gt; Ctrl-_</p></blockquote>
<p>역시나 마법처럼 &lt;/html&gt; 가 입력되는게 아주 만족 스럽군요 :D 알아갈 수록 아름다운 vim 세상입니다&#8230;</p>
<p>젠투 유져는 아니지만 관심있으실 분들을 위해 홈페이지 링크를 :)</p>
<p><a href='http://www.vim.org/scripts/script.php?script_id=13'>http://www.vim.org/scripts/script.php?script_id=13</a></p>
<p>p.s) 메뉴얼에는 컨트롤, _ 로 되어 있지만 실제로는 컨트롤, &#8211; 조합으로도 정상적으로 잘 동작합니다.</p><div style="width: 180px; margin-left: auto; margin-right: auto; margin-bottom: 30px; margin-top: 30px; ">
    <object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='73' height='79' align='left' style="border-bottom: 1px solid #CFD4DA; border-right: 1px solid #CFD4DA;">
    <param name='allowScriptAccess' value='always'/>
    <param name='movie' value='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2005%2F09%2F13%2Fvim-plugin-close-tag%2F&rdate=2005-09-13+16%3A44%3A21&rawhtml=&skin=1&showhitcnt=1&platform=5'/>
    <param name='quality' value='high'/>
    <param name='wmode' value='window'/>
    <embed src='http://www.mixsh.com/widget/mixup/loader.html?muid=52225&guid=http%3A%2F%2Fb.mytears.org%2F2005%2F09%2F13%2Fvim-plugin-close-tag%2F&rdate=2005-09-13+16%3A44%3A21&rawhtml=&skin=1&showhitcnt=1&platform=5' quality='high' wmode='window' width='73' height='79' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>
    </object>
		</div><h3 style="clear:both;">Related Posts</h3><ul class="related_post"><li>1/29/2009 -- <a href="http://b.mytears.org/2009/01/1236" title="wp-codebox, wp-openid 버그 패치">wp-codebox, wp-openid 버그 패치 (4)</a></li><li>1/28/2009 -- <a href="http://b.mytears.org/2009/01/1228" title="번역: 한국의 홈브류 인터넷">번역: 한국의 홈브류 인터넷 (0)</a></li><li>1/28/2009 -- <a href="http://b.mytears.org/2009/01/1224" title="인터넷 뱅킹과 크로스 브라우징">인터넷 뱅킹과 크로스 브라우징 (2)</a></li><li>1/24/2009 -- <a href="http://b.mytears.org/2009/01/1222" title="블로그 업데이트 완료!">블로그 업데이트 완료! (11)</a></li><li>1/23/2009 -- <a href="http://b.mytears.org/2009/01/1192" title="Punbb update">Punbb update (0)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://b.mytears.org/2005/09/257/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
