<?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; BASH</title>
	<atom:link href="http://blog.ebrahim.ir/tag/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ebrahim.ir</link>
	<description># tail -f /var/log/experience</description>
	<lastBuildDate>Wed, 25 Aug 2010 22:16:39 +0000</lastBuildDate>
	<language>fa</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>روشی برای تسریع dpkg</title>
		<link>http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/</link>
		<comments>http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 00:56:15 +0000</pubDate>
		<dc:creator>ابراهیم</dc:creator>
				<category><![CDATA[رایانه]]></category>
		<category><![CDATA[APT]]></category>
		<category><![CDATA[BASH]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[dpkg]]></category>
		<category><![CDATA[Ext4]]></category>
		<category><![CDATA[ReiserFS]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[Tokyo Cabinet]]></category>
		<category><![CDATA[بهینه‌سازی]]></category>
		<category><![CDATA[سامانهٔ عامل]]></category>
		<category><![CDATA[سامانهٔ پرونده]]></category>
		<category><![CDATA[لوح سخت]]></category>
		<category><![CDATA[لینوکس]]></category>
		<category><![CDATA[محک‌زنی]]></category>
		<category><![CDATA[کارآیی]]></category>

		<guid isPermaLink="false">http://blog.ebrahim.ir/?p=292</guid>
		<description><![CDATA[همون طور که احتمالاً می‌دونید dpkg توساخت0 مدیریت بسته‌ها1 در Debian است. یعنی APT و Synaptic و Aptitude و &#8230; همه روی dpkg بنا شده اند. dpkg برای نگه‌داری بعضی اطلاعات بسته‌های نصب‌شده، از تعداد زیادی (برای من حدود ۹۰۰۰ تا) پروندهٔ2 کوچک توی مسیر ‎/var/lib/dpkg/info استفاده می‌کنه. هر بار که بسته‌ای رو نصب یا [...]]]></description>
			<content:encoded><![CDATA[<p><!--startnum=0--></p>
<p>همون طور که احتمالاً می‌دونید dpkg توساخت<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_0_292" id="identifier_0_292" class="footnote-link footnote-identifier-link" title="Back-end">0</a></sup> مدیریت بسته‌ها<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_1_292" id="identifier_1_292" class="footnote-link footnote-identifier-link" title="Package management">1</a></sup> در Debian است. یعنی APT و Synaptic و Aptitude و &#8230; همه روی dpkg بنا شده اند.</p>
<p>dpkg برای نگه‌داری بعضی اطلاعات بسته‌های نصب‌شده، از تعداد زیادی (برای من حدود ۹۰۰۰ تا) پروندهٔ<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_2_292" id="identifier_2_292" class="footnote-link footnote-identifier-link" title="File">2</a></sup> کوچک توی مسیر ‎/var/lib/dpkg/info استفاده می‌کنه. هر بار که بسته‌ای رو نصب یا حذف می‌کنید dpkg همهٔ اون پرونده‌ها رو از روی لوح<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_3_292" id="identifier_3_292" class="footnote-link footnote-identifier-link" title="Disk">3</a></sup> می‌خونه. این کار روی سامانهٔ پروندهٔ<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_4_292" id="identifier_4_292" class="footnote-link footnote-identifier-link" title="File system">4</a></sup> مورد استفادهٔ من، که Ext4 هست، اولین بار بیست-سی ثانیه‌ای طول می‌کشه، که برای من مدت زیادی هست. این کار در دفعات بعدی به علت قرار گرفتن همهٔ اون پرونده‌ها در نهان‌گاه<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_5_292" id="identifier_5_292" class="footnote-link footnote-identifier-link" title="Cache">5</a></sup> سامانهٔ پرونده در حافظهٔ اصلی، بسیار سریع‌تر انجام می‌شه، تا وقتی که دوباره از نهان‌گاه خارج بشند.</p>
<p>این مشکل هر از گاهی یک سیخی بهم می‌زد و روی اعصابم راه می‌رفت. فکرهای مختلفی برای حلش به ذهنم رسید. از بسیار پیچیده، مثل طراحی و پیاده‌سازی مجدد dpkg روی Tokyo Cabinet یا SQLite، تا بسیار ساده:</p>
<p>شاید بدونید که سامانهٔ پروندهٔ ReiserFS در کار با پرونده‌های کوچک بسیار عالی عمل می‌کنه. علتش هم استفاده از فن «ته‌چِپانی»<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_6_292" id="identifier_6_292" class="footnote-link footnote-identifier-link" title="Tail packing">6</a></sup> است.<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_7_292" id="identifier_7_292" class="footnote-link footnote-identifier-link" title="http://en.wikipedia.org/wiki/ReiserFS#Performance">7</a></sup> فکر کردم شاید اگر پوشهٔ  ‎/var/lib/dpkg/info رو توی ReiserFS نگه دارم، مشکل حل بشه. این کار رو کردم، ولی به خاطر کارکرد<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_8_292" id="identifier_8_292" class="footnote-link footnote-identifier-link" title="Mechanism">8</a></sup> داخلی dpkg روی کل ‎/var/lib/dpkg:</p>

<div class="wp_syntax" dir="ltr"><div class="code"><pre class="none" style="font-family:monospace;">$ sudo su -
# cd /var/lib
# tar cpzf dpkg.tar.gz dpkg
# dd if=/dev/zero of=dpkg.reiserfs bs=$((256*1024*1024)) count=1
# mkreiserfs -f dpkg.reiserfs
# mount -oloop dpkg.reiserfs dpkg
# tar xpf dpkg.tar.gz</pre></div></div>

<p>و بعد آزمودن و دائمی کردن با افزودن به fstab‏:</p>

<div class="wp_syntax" dir="ltr"><div class="code"><pre class="none" style="font-family:monospace;"># echo 3 &gt;/proc/sys/vm/drop_caches
# apt-get install hello
# apt-get purge hello
# echo /var/lib/dpkg.reiserfs /var/lib/dpkg reiserfs loop,noatime 0 1 &gt;&gt;/etc/fstab</pre></div></div>

<p>فکره جواب داد و سرعت dpkg بسیار به‌تر شد. حالا حتی اولین بار هم dpkg اون کار رو در دو-سه ثانیه انجام می‌ده.</p>
<p>علاوه بر مهارت ReiserFS در کار با پرونده‌های کوچک، چند نکتهٔ دیگه هم قابل ذکر هست. یکی این که Ext4 به علت فن «حوزه»<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_9_292" id="identifier_9_292" class="footnote-link footnote-identifier-link" title="Extent">9</a></sup> در کار با پرونده‌های نسبتاً بزرگی که یک‌جا تخصیص<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_10_292" id="identifier_10_292" class="footnote-link footnote-identifier-link" title="Allocation">10</a></sup> می‌یابند بسیار سریع هست. برای همین به dd گفتم که کل پرونده رو یک‌جا بسازه.</p>
<p>از طرفی چون، در نتیجهٔ نکتهٔ قبل، کل پرونده‌های مربوط به dpkg روی لوح نزدیک به هم قرار می‌گیرند و پراکنده نیستند، با خونده شدن یک پرونده از اون حوالی، تعداد زیادی از بقیه‌شون هم توی نهان‌گاه لوح و تعدادی هم توی نهان‌گاه سامانهٔ پرونده قرار می‌گیرند. همین امر باعث می‌شه کلی زمان جویش<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_11_292" id="identifier_11_292" class="footnote-link footnote-identifier-link" title="Seek">11</a></sup> که قبلاً برای رسیدن به پرنده‌های پراکنده در اطراف و اکناف لوح هدر می‌رفت، صرفه‌جویی بشه.</p>
<p>به گزینهٔ<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_12_292" id="identifier_12_292" class="footnote-link footnote-identifier-link" title="Option">12</a></sup> noatime در fstab هم دقت کنید. رفتار معمولی سامانه‌های پرونده این هست که در هر دست‌رسی (اعم از خواندن یا نوشتن) به یک پرونده، زمان دست‌رسی رو ذخیره می‌کنند. این خیلی بده! هر دست‌رسی = حداقل یک عمل نوشتن روی لوح، و عمل نوشتن هم معمولاً کندتر از خوندن هست. نکته این جاست که برنامه‌های رایج امروزی معمولاً روی اون زمان ثبت‌شده برای آخرین دست‌رسی حساب نمی‌کنند و عملاً اون عدد بی‌استفاده است! گزینهٔ noatime به سامانهٔ پرونده می‌گه که کلاً قید ثبت اون زمان رو بزنه و به این ترتیب کلی عمل نوشتن صرفه‌جویی کنه.</p>
<ol start="0" class="footnotes"><li id="footnote_0_292" class="footnote">Back-end</li><li id="footnote_1_292" class="footnote">Package management</li><li id="footnote_2_292" class="footnote">File</li><li id="footnote_3_292" class="footnote">Disk</li><li id="footnote_4_292" class="footnote">File system</li><li id="footnote_5_292" class="footnote">Cache</li><li id="footnote_6_292" class="footnote">Tail packing</li><li id="footnote_7_292" class="footnote">http://en.wikipedia.org/wiki/ReiserFS#Performance</li><li id="footnote_8_292" class="footnote">Mechanism</li><li id="footnote_9_292" class="footnote">Extent</li><li id="footnote_10_292" class="footnote">Allocation</li><li id="footnote_11_292" class="footnote">Seek</li><li id="footnote_12_292" class="footnote">Option</li></ol>]]></content:encoded>
			<wfw:commentRss>http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>از پیغام‌های خطای STL نجات یافتم</title>
		<link>http://blog.ebrahim.ir/1387/09/got-rid-of-stl-error-messages/</link>
		<comments>http://blog.ebrahim.ir/1387/09/got-rid-of-stl-error-messages/#comments</comments>
		<pubDate>Sat, 22 Nov 2008 21:51:30 +0000</pubDate>
		<dc:creator>ابراهیم</dc:creator>
				<category><![CDATA[رایانه]]></category>
		<category><![CDATA[BASH]]></category>
		<category><![CDATA[C++‎]]></category>
		<category><![CDATA[STL]]></category>
		<category><![CDATA[ابزار]]></category>
		<category><![CDATA[برنامه‌نویسی]]></category>
		<category><![CDATA[دست‌نوشته]]></category>
		<category><![CDATA[نرم‌افزار آزاد]]></category>
		<category><![CDATA[هم‌گردان]]></category>

		<guid isPermaLink="false">http://blog.ebrahim.ir/?p=70</guid>
		<description><![CDATA[اگر برنامه‌نویس C++‎ باشی، حتماً تا حالا مورد آزار و اذیت پیغام‌های خطای سرسام‌آور هم‌گردان0 در مورد STL قرار گرفته‌ای. مثلاً این: testmm2.cpp:31: error: no matching function for call to ‘std::multimap&#60;int*, int, std::less&#60;int*&#62;, std::allocator&#60;std::pair&#60;int* const, int&#62; &#62; &#62;::insert(int)’ /usr/include/c++/4.3/bits/stl_multimap.h:407: note: candidates are: typename std::_Rb_tree&#60;_Key, std::pair&#60;const _Key, _Tp&#62;, std::_Select1st&#60;std::pair&#60;const_Key, _Tp&#62; &#62;, _Compare, typename _Alloc::rebind&#60;std::pair&#60;const _Key, _Tp&#62; [...]]]></description>
			<content:encoded><![CDATA[<p><!--startnum=0--></p>
<p>اگر برنامه‌نویس C++‎ باشی، حتماً تا حالا مورد آزار و اذیت پیغام‌های خطای سرسام‌آور هم‌گردان<sup><a href="http://blog.ebrahim.ir/1387/09/got-rid-of-stl-error-messages/#footnote_0_70" id="identifier_0_70" class="footnote-link footnote-identifier-link" title="Compiler">0</a></sup> در مورد STL قرار گرفته‌ای. مثلاً این:</p>

<div class="wp_syntax" dir="ltr"><div class="code"><pre class="none" style="font-family:monospace;">testmm2.cpp:31: error: no matching function for call to ‘std::multimap&lt;int*, int, std::less&lt;int*&gt;, std::allocator&lt;std::pair&lt;int* const, int&gt; &gt; &gt;::insert(int)’
/usr/include/c++/4.3/bits/stl_multimap.h:407: note: candidates are: typename std::_Rb_tree&lt;_Key, std::pair&lt;const _Key, _Tp&gt;, std::_Select1st&lt;std::pair&lt;const_Key, _Tp&gt; &gt;, _Compare, typename _Alloc::rebind&lt;std::pair&lt;const _Key, _Tp&gt; &gt;::other&gt;::iterator std::multimap&lt;_Key, _Tp, _Compare, _Alloc&gt;::insert(const std::pair&lt;const _Key, _Tp&gt;&amp;) [with _Key = int*, _Tp = int, _Compare = std::less&lt;int*&gt;, _Alloc = std::allocator&lt;std::pair&lt;int* const, int&gt; &gt;]
/usr/include/c++/4.3/bits/stl_multimap.h:431: note:                 typename std::_Rb_tree&lt;_Key, std::pair&lt;const _Key, _Tp&gt;, std::_Select1st&lt;std::pair&lt;const _Key, _Tp&gt; &gt;, _Compare, typename _Alloc::rebind&lt;std::pair&lt;const _Key, _Tp&gt; &gt;::other&gt;::iterator std::multimap&lt;_Key, _Tp, _Compare, _Alloc&gt;::insert(typename std::_Rb_tree&lt;_Key, std::pair&lt;const _Key, _Tp&gt;, std::_Select1st&lt;std::pair&lt;const _Key, _Tp&gt; &gt;, _Compare, typename _Alloc::rebind&lt;std::pair&lt;const _Key, _Tp&gt; &gt;::other&gt;::iterator, const std::pair&lt;const _Key, _Tp&gt;&amp;) [with _Key = int*, _Tp = int, _Compare = std::less&lt;int*&gt;, _Alloc = std::allocator&lt;std::pair&lt;int* const, int&gt; &gt;]</pre></div></div>

<p>‎<br />
حالا این یکی بود. وقتی ده-پونزده تا از این‌ها یک‌جا رخ می‌ده، خیلی افتضاح می‌شه.</p>
<p>مدت‌ها با این مشکل کنار اومده بودم و دردش رو تحمل می‌کردم. اما اخیراً یک راه نجات یافتم: ابزاری  به نام <a href="http://www.bdsoft.com/tools/stlfilt.html">STLFilt</a>. یک نرم‌افزار آزاد هست که خروجی هم‌گردان C++‎ رو می‌گیره و اون پیغام‌های وحشت‌ناک رو مهربون می‌کنه. مثلاً پیغام بالا رو تبدیل می‌کنه به این:</p>

<div class="wp_syntax" dir="ltr"><div class="code"><pre class="none" style="font-family:monospace;">testmm2.cpp:31: error: No match for ‘multimap&lt;int *, int&gt;::insert(int)’
stl_multimap.h:407: candidates are: map&lt;int *, int&gt;::iter multimap&lt;int *, int&gt;
    ::insert(const pair&lt;const int *, int&gt; &amp;)
stl_multimap.h:431: map&lt;
        int *, int
    &gt;::iter multimap&lt;
        int *, int
    &gt;::insert(map&lt;int *, int&gt;::iter, const pair&lt;const int *, int&gt; &amp;)</pre></div></div>

<p>آخش! حالا می‌شه خوندش!</p>
<p>برای استفاده از STLFilt اول باید بستهٔ مربوط به هم‌گردانت رو بگیری. مثلاً gstlfilt.zip برای G++‎. توش کلی پرونده هست که همه رو بی‌خیال می‌شی به جز gSTLFilt.pl که اصل کار رو انجام می‌ده. از stdin می‌خونه و توی stdout می‌نویسه. کاری که من کردم این بود<sup><a href="http://blog.ebrahim.ir/1387/09/got-rid-of-stl-error-messages/#footnote_1_70" id="identifier_1_70" class="footnote-link footnote-identifier-link" title="مثل همیشه نقل به مضمون و آزمایش&zwnj;نشده">1</a></sup>:</p>

<div class="wp_syntax" dir="ltr"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">su</span>
<span style="color: #007800;">F</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>stlfilt.pl
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'#!/usr/bin/perl'</span> <span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #007800;">$F</span>
<span style="color: #c20cb9; font-weight: bold;">cat</span> gSTLFilt.pl <span style="color: #000000; font-weight: bold;">&gt;&gt;</span><span style="color: #007800;">$F</span>
<span style="color: #c20cb9; font-weight: bold;">chmod</span> +x <span style="color: #007800;">$F</span></pre></div></div>

<p>و برای استفاده:</p>

<div class="wp_syntax" dir="ltr"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">|</span> stlfilt.pl</pre></div></div>

<p>برای این که هر بار نخوام stderr دستور ساخت<sup><a href="http://blog.ebrahim.ir/1387/09/got-rid-of-stl-error-messages/#footnote_2_70" id="identifier_2_70" class="footnote-link footnote-identifier-link" title="Build">2</a></sup> (مثلاً make)  رو به stdoutش redirect<sup><a href="http://blog.ebrahim.ir/1387/09/got-rid-of-stl-error-messages/#footnote_3_70" id="identifier_3_70" class="footnote-link footnote-identifier-link" title="معادل خوبی براش داری بگو">3</a></sup> کنم، دست‌نوشتهٔ<sup><a href="http://blog.ebrahim.ir/1387/09/got-rid-of-stl-error-messages/#footnote_4_70" id="identifier_4_70" class="footnote-link footnote-identifier-link" title="Script">4</a></sup> <code>/usr/local/bin/stlfilt</code> رو با این محتوا ساختم:</p>

<div class="wp_syntax" dir="ltr"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #ff0000;">&quot;$@&quot;</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">|</span> stlfilt.pl</pre></div></div>

<p>و <code>chmod +x</code> هم یادم نره. <img src='http://blog.ebrahim.ir/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
حالا این‌جوری استفاده می‌شه:</p>

<div class="wp_syntax" dir="ltr"><div class="code"><pre class="bash" style="font-family:monospace;">stlfilt <span style="color: #c20cb9; font-weight: bold;">make</span></pre></div></div>

<p>با دست‌نوشته‌ها زندگی زیباتره! <img src='http://blog.ebrahim.ir/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>ویرایش: امید آن می‌رود که با معرفی «مفهوم»<sup><a href="http://blog.ebrahim.ir/1387/09/got-rid-of-stl-error-messages/#footnote_5_70" id="identifier_5_70" class="footnote-link footnote-identifier-link" title="Concept">5</a></sup>ها در C++0x (به زودی!) کل مشکل از بیخ حل بشه و دیگه نیازی به ابزار اضافی نباشه.</p>
<ol start="0" class="footnotes"><li id="footnote_0_70" class="footnote">Compiler</li><li id="footnote_1_70" class="footnote">مثل همیشه نقل به مضمون و آزمایش‌نشده</li><li id="footnote_2_70" class="footnote">Build</li><li id="footnote_3_70" class="footnote">معادل خوبی براش داری بگو</li><li id="footnote_4_70" class="footnote">Script</li><li id="footnote_5_70" class="footnote">Concept</li></ol>]]></content:encoded>
			<wfw:commentRss>http://blog.ebrahim.ir/1387/09/got-rid-of-stl-error-messages/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>هرزنامه‌نگار نبودیم که شدیم [0]</title>
		<link>http://blog.ebrahim.ir/1387/08/we-were-not-spammer-but-got-0/</link>
		<comments>http://blog.ebrahim.ir/1387/08/we-were-not-spammer-but-got-0/#comments</comments>
		<pubDate>Sat, 15 Nov 2008 13:36:32 +0000</pubDate>
		<dc:creator>ابراهیم</dc:creator>
				<category><![CDATA[رایانه]]></category>
		<category><![CDATA[BASH]]></category>
		<category><![CDATA[اینترنت]]></category>
		<category><![CDATA[خادم]]></category>
		<category><![CDATA[خدمت]]></category>
		<category><![CDATA[راه‌بری]]></category>
		<category><![CDATA[رایانامه]]></category>
		<category><![CDATA[شهاب]]></category>
		<category><![CDATA[لینوکس]]></category>
		<category><![CDATA[هرزنامه]]></category>

		<guid isPermaLink="false">http://blog.ebrahim.ir/?p=25</guid>
		<description><![CDATA[مدیر0 یک خادم1 رایانامه2 هستم به نام «شهاب». بعد از مدت‌ها که داشت به خوبی و خوشی کارش رو می‌کرد، یک روز دیدم حدود بیست هزار تا رایانامه توی صفش گیر کرده. معمولاً این عدد برای شهاب حدود یکی دو هزار تاست. از اون طرف یکی‌یکی رایانامه‌ها و پیامک3های دوستان می‌رسید که «شهاب میل نمی‌فرسته» [...]]]></description>
			<content:encoded><![CDATA[<p><!--startnum=0--></p>
<p>مدیر<sup><a href="http://blog.ebrahim.ir/1387/08/we-were-not-spammer-but-got-0/#footnote_0_25" id="identifier_0_25" class="footnote-link footnote-identifier-link" title="Administrator">0</a></sup> یک خادم<sup><a href="http://blog.ebrahim.ir/1387/08/we-were-not-spammer-but-got-0/#footnote_1_25" id="identifier_1_25" class="footnote-link footnote-identifier-link" title="Server">1</a></sup> رایانامه<sup><a href="http://blog.ebrahim.ir/1387/08/we-were-not-spammer-but-got-0/#footnote_2_25" id="identifier_2_25" class="footnote-link footnote-identifier-link" title="E-mail">2</a></sup> هستم به نام «شهاب». بعد از مدت‌ها که داشت به خوبی و خوشی کارش رو می‌کرد، یک روز دیدم حدود بیست هزار تا رایانامه توی صفش گیر کرده. معمولاً این عدد برای شهاب حدود یکی دو هزار تاست. از اون طرف یکی‌یکی رایانامه‌ها و پیامک<sup><a href="http://blog.ebrahim.ir/1387/08/we-were-not-spammer-but-got-0/#footnote_3_25" id="identifier_3_25" class="footnote-link footnote-identifier-link" title="SMS">3</a></sup>های دوستان می‌رسید که «شهاب میل نمی‌فرسته» و «دوباره دانلود گذاشتی رو شهاب؟! کار نمی‌کنه!». همون طور که حتماً فهمیده‌اید وضعیت شهاب وخیم بود.</p>
<p>چون علائم شهاب شبیه تجربه‌ای نه‌چندان‌قدیمی بود، قبل از هر چیز، فضای خالی بخش<sup><a href="http://blog.ebrahim.ir/1387/08/we-were-not-spammer-but-got-0/#footnote_4_25" id="identifier_4_25" class="footnote-link footnote-identifier-link" title="Partition">4</a></sup>های لوح<sup><a href="http://blog.ebrahim.ir/1387/08/we-were-not-spammer-but-got-0/#footnote_5_25" id="identifier_5_25" class="footnote-link footnote-identifier-link" title="Disk">5</a></sup> رو بررسی کردم. دیدم که بعله، بخش <code>/var</code> پر شده. با استفاده از</p>

<div class="wp_syntax" dir="ltr"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-nr</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">less</span></pre></div></div>

<p>دیدم که کار، کار نگاره<sup><a href="http://blog.ebrahim.ir/1387/08/we-were-not-spammer-but-got-0/#footnote_6_25" id="identifier_6_25" class="footnote-link footnote-identifier-link" title="Log">6</a></sup>هاست<sup><a href="http://blog.ebrahim.ir/1387/08/we-were-not-spammer-but-got-0/#footnote_7_25" id="identifier_7_25" class="footnote-link footnote-identifier-link" title="این دستورهایی که نقل می&zwnj;کنم، نقل به مضمون هستند! ">7</a></sup>. از اون‌جا که بخش <code>/var</code> دیگه جا نداشت، باید شاخهٔ<sup><a href="http://blog.ebrahim.ir/1387/08/we-were-not-spammer-but-got-0/#footnote_8_25" id="identifier_8_25" class="footnote-link footnote-identifier-link" title="Directory">8</a></sup> <code>/var/log</code> رو به بخش دیگری منتقل می‌کردم. پس بعد از متوقف کردن [تقریباً] همهٔ خدمت<sup><a href="http://blog.ebrahim.ir/1387/08/we-were-not-spammer-but-got-0/#footnote_9_25" id="identifier_9_25" class="footnote-link footnote-identifier-link" title="Service">9</a></sup>ها، از جمله apache2 و postfix و klogd و غیره، زدم:</p>

<div class="wp_syntax" dir="ltr"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log <span style="color: #000000; font-weight: bold;">/</span>home
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>log <span style="color: #000000; font-weight: bold;">/</span>var</pre></div></div>

<p>خدمت‌ها رو آغاز<sup><a href="http://blog.ebrahim.ir/1387/08/we-were-not-spammer-but-got-0/#footnote_10_25" id="identifier_10_25" class="footnote-link footnote-identifier-link" title="Start">10</a></sup> کردم و همه چیز خوب به نظر می‌رسید.</p>
<p>خارج شدم، اما ته دلم هنوز نگران بودم. چون نمی‌دونستم چرا این همه نگاره تولید شده. با این حال راه راحت‌تر رو انتخاب کردم(!): به خودم گفتم «حالا بذار تا فردا کار کنه ببینیم چی می‌شه». <img src='http://blog.ebrahim.ir/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>&#8230; ادامه دارد &#8230;</p>
<ol start="0" class="footnotes"><li id="footnote_0_25" class="footnote">Administrator</li><li id="footnote_1_25" class="footnote">Server</li><li id="footnote_2_25" class="footnote">E-mail</li><li id="footnote_3_25" class="footnote">SMS</li><li id="footnote_4_25" class="footnote">Partition</li><li id="footnote_5_25" class="footnote">Disk</li><li id="footnote_6_25" class="footnote">Log</li><li id="footnote_7_25" class="footnote"><span style="direction: rtl; unicode-bidi: bidi-override;">این دستورهایی که نقل می‌کنم، نقل به مضمون هستند! </span></li><li id="footnote_8_25" class="footnote">Directory</li><li id="footnote_9_25" class="footnote">Service</li><li id="footnote_10_25" class="footnote">Start</li></ol>]]></content:encoded>
			<wfw:commentRss>http://blog.ebrahim.ir/1387/08/we-were-not-spammer-but-got-0/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (user agent is rejected)

Served from: blog.ebrahim.ir @ 2012-02-07 00:13:02 -->
