Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
1118 lines (636 sloc) 48 KB
<!DOCTYPE html>
<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Linux Primer</title>
<meta name="author" content="datawolf">
<meta name="description" content="每一次深入一个技术问题,随着挖掘的深入,都发现其背后总有非常深的背景知识,甚至需要深入很多底层系统,这个过程有时会让自己迷失,会让自己忘记了当初的目的。 前言 在讨论内核如何解析内核参数之前,我们先了解一下如何给内核参数。详细的内核参数的使用说明,请参加内核文档 Documentation/ &hellip;">
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="http://datawolf.github.com">
<link href="/favicon.png" rel="icon">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<link href="/atom.xml" rel="alternate" title="Linux Primer" type="application/atom+xml">
<script src="/javascripts/modernizr-2.0.js"></script>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="./javascripts/lib/jquery.min.js"%3E%3C/script%3E'))</script>
<script src="/javascripts/octopress.js" type="text/javascript"></script>
<!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
<!--<link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css"> -->
</head>
<body >
<header role="banner"><div style="
height: 6px;
position: fixed;
background: #a2cbfa;
width: 100%;
left: 0;
top: 0;
z-index: 3;
"></div>
<hgroup>
<h1><a href="/">Linux Primer</a></h1>
<h2>Dive into linux kernel</h2>
<p class="profile"><a href="/"><img src="/images/profile.png"></a></p>
</hgroup>
</header>
<nav role="navigation"><ul class="subscription" data-subscription="rss">
<li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
</ul>
<ul class="main-navigation">
<li><a href="/">Blog</a></li>
<li><a href="/blog/archives">Archives</a></li>
<li><a href="/books">Books</a></li>
</ul>
</nav>
<div id="main">
<div id="content">
<div class="blog-index">
<article>
<header>
<h1 class="entry-title"><a href="/blog/2015/06/22/how-to-parse-linux-kernel-parameters/">How to Parse Linux Kernel Parameters</a></h1>
<p class="meta">
<time datetime="2015-06-22T22:13:00+08:00" pubdate data-updated="true">Jun 22<span>nd</span>, 2015</time>
| <a href="/blog/2015/06/22/how-to-parse-linux-kernel-parameters/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><blockquote><p>每一次深入一个技术问题,随着挖掘的深入,都发现其背后总有非常深的背景知识,甚至需要深入很多底层系统,这个过程有时会让自己迷失,会让自己忘记了当初的目的。</p></blockquote>
<h2>前言</h2>
<p>在讨论内核如何解析内核参数之前,我们先了解一下如何给内核参数。详细的内核参数的使用说明,请参加内核文档 <a href="http://lxr.free-electrons.com/source/Documentation/kernel-parameters.txt">Documentation/kernel-parameters.txt</a>,这里我简单总结如下:</p>
<p>假如有如下的cmdline传递给内核</p>
<pre><code>mem=900M console=ttyS0,115200 foo=1 bar ramoops.size=0x8000 earlyprintk -- msg=hello test
</code></pre>
<ol>
<li>内核只解析<code>--</code>字符以前的参数。</li>
<li><code>--</code>字符以后的参数,都会传递给init进程。</li>
<li>如果内核遇到不能识别的参数时,且该参数中没有包含字符<code>.</code>,内核将会把它传递给init进程,如果参数中有<code>=</code>字符时,内核会将该参数传递给init进程作为其环境变量。</li>
<li>模块可以通过两种方式传递参数:一个是命令行,一个是modprobe。
<pre><code> (kernel command line) usbcore.blinkenlights=1
(modprobe command line) modprobe usbcore blinkenlights=1
</code></pre></li>
<li>编译进内核的模块,需要使用命令行的方式给其传递参数。</li>
<li>modprobe在加载内核模块时,会去查找<code>/proc/cmdline</code>来收集模块的参数,所以未编译进内核的可加载的模块也可以使用命令行来传递参数。</li>
<li>内核参数中,中划线<code>-</code>和下划线<code>_</code>时等价的,例如,如下的两个参数时等价的
<pre><code> log_buf_len=1M print-fatal-signals=1
log-buf-len=1M print_fatal_signals=1
</code></pre></li>
<li>如果参数的值中有空格,可以使用双引号将其包住,例如:
<pre><code> param="spaces in here"
</code></pre></li>
</ol>
<h2>第一个阶段</h2>
<h2>第二个阶段</h2>
<h2>第三个阶段</h2>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2015/03/21/sys-rq-in-linux-kernel/">Sys Rq in Linux Kernel</a></h1>
<p class="meta">
<time datetime="2015-03-21T16:57:00+08:00" pubdate data-updated="true">Mar 21<span>st</span>, 2015</time>
| <a href="/blog/2015/03/21/sys-rq-in-linux-kernel/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><p>曾几何时,笔者在使用ubuntu系统时,内核卡死,然后就束手无策了。只能去把电源来重启系统,但这是非常危险的,有可能会造成数据的丢失或者磁盘的损害。</p>
<p>幸好,使用sysrq组合键可以让系统安全的进行重启,并能收集一些系统的信息,方便问题的定位。</p>
<p>在终端上同时按Alt, SysRq和命令键则会执行SysRq命令, SysRq键就是&#8221;Print Screen&#8221;健. 比如Alt+SysRq+b则重启机器。ALT+SysRQ+X(此处X代表命令参数)这是一组“魔术组合键”,只要内核没有被完全锁住,不管内核在做什么事情,使用这些组合键能即时打印出内核的信息。</p>
<p>使用sysrq组合键是了解系统目前运行情况的最佳方式。如果系统出现挂起(例如:死机等)的情况或在诊断一些和内核相关比较难解决的问题的时候,使用sysrq键是个比较好的方式。</p>
<p>在有些系统中,默认SysRq组合键是关闭的。 打开这个功能,运行:</p>
<pre><code># echo 1 &gt; /proc/sys/kernel/sysrq
</code></pre>
<p>关闭这个功能:</p>
<pre><code># echo 0 &gt; /proc/sys/kernel/sysrq
</code></pre>
<p>如果想让此功能一直生效,在/etc/sysctl.conf里面设置kernel.sysrq的值为1. 重新启动以后,此功能将会自动打开。</p>
<pre><code>kernel.sysrq = 1
</code></pre>
<p>因为打开sysrq键的功能以后,有终端访问权限的用户将会拥有一些特别的功能。因此,除非是要调试,解决问题,一般情况下,不要打开此功能。如果一定要打开,请确保你的终端访问的安全性。</p>
<p>有几种方式能触发sysrq事件。在带有AT键盘的一般系统上,在终端上输入一下组合键:</p>
<pre><code>Alt+PrintScreen+[CommandKey]
</code></pre>
<p>如果你在机器上有root权限,你能把commandkey字符写入到 <code>/proc/sysrq-trigger</code> 文件。这能帮助你通过脚本或你不在系统终端上的时候触发sysrq事件。</p>
<pre><code># echo 'm' &gt; /proc/sysrq-trigger
</code></pre>
<p>哪些类型的sysrq事件能被触发?请参见文档:https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/sysrq.txt</p>
<h2>下面具体介绍一些如何安全的重启卡死的linux系统</h2>
<h4>使用 SysRq 重启计算机的方法:</h4>
<p>台式机键盘或者全尺寸键盘: <code>Alt + SysRq + [R-E-I-S-U-B]</code></p>
<p>部分笔记本键盘: <code>Fn + Alt + SysRq + [R-E-I-S-U-B]</code></p>
<p>解释:括号内的英文字母需要依次顺序按下,而且每次按下字母后需要间隔 5-10s 再执行下一个动作。(如 <code>alter +SysRq + R</code>,间隔10s 后再按 alter+ SysRq +E,以此类推)切记不可快速按下 <code>R-E-I-S-U-B</code> ,否则后果和 扣电池拔电源线无异!</p>
<h4>下面详细讲解一下各个序列:</h4>
<ul>
<li><code>unRaw</code> – 把键盘设置为 ASCII 模式,使按键可以穿透 x server 捕捉传递给内核</li>
<li><code>tErminate</code> – 向除 init 外进程发送 SIGTERM 信号,让其自行结束</li>
<li><code>kIll</code> - 向除 init 以外所有进程发送 SIGKILL 信号,强制结束进程</li>
<li><code>Sync</code> – 同步缓冲区数据到硬盘,避免数据丢失</li>
<li><code>Unmount</code> – 将所有已经挂载的文件系统 重新挂载为只读</li>
<li><code>reBoot</code> - 立即重启计算机</li>
</ul>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2015/02/13/how-to-build-linux-kernel-in-ubuntu-faster/">How to Build Linux Kernel in Ubuntu Faster?</a></h1>
<p class="meta">
<time datetime="2015-02-13T22:39:00+08:00" pubdate data-updated="true">Feb 13<span>th</span>, 2015</time>
| <a href="/blog/2015/02/13/how-to-build-linux-kernel-in-ubuntu-faster/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><h2>传统编译方式</h2>
<p>通常,我们要需要编译linux内核,大概要经历以下几个步骤:</p>
<h3>配置内核</h3>
<pre><code>make menuconfig
</code></pre>
<h3>编译内核和模块</h3>
<p>依次执行如下命令:</p>
<pre><code>make
make modules
make modules_install
make install
</code></pre>
<h2>使用make-kpkg</h2>
<p>如果是ubuntu的用户,可以使用make-kpkg简化这个流程,而且还能带来额外的好处。
在ubuntu下,安装<code>kernel-package</code>这个包之后,就可以使用<code>make-kpkg</code>了。</p>
<pre><code>sudo apt-get install kernel-package
</code></pre>
<p>使用make-kpkg编译内核,第一个步骤“配置内核是必不可少的”,在这里,我比较建议在发行版默认的config的基础上再进行配置,这样配置出来的内核和发行版本身具有更好的相容性。比如ubuntu 14.10,可以在运行<code>make menuconfig</code>之前执行命令<code>cp /boot/config-3.13.0-44-generic .config</code>。</p>
<p>配置完内核后,接下来执行真正的编译过程。通常我们可以执行如下命令:</p>
<pre><code>make-kpkg --initrd -j 8 --append-to-version -20150213001 kernel_image
</code></pre>
<ul>
<li>&#8211;initrd选项会让make-kpkg自动帮助我们生成initramfs</li>
<li>&#8211;revisin会让生成的deb文件加上一个版本信息,这个参数只影响到文件名。</li>
<li>&#8211;append-to-version 也是一种版本信息,它不仅会出现在deb安装包的名称中,也会影响到kernel的名称。</li>
<li>kernel_image表示生成内核和默认模块的安装包,另外您也可以加上kernel_headers,这样也会生成一个内核头文件的安装包。</li>
</ul>
<p>编译过程执行完毕之后,会在上层目录里生成一个deb安装包。</p>
<p>使用make-kpkg来编译内核,还有其他好处。因为我们是通过包管理器来安装新的内核,当不再需要这个内核时,就可以简单的通过dpkg命令、新立得软件包管理器或者Ubuntu软件中心来完全卸载,而不需要一个个手动删除修改。</p>
<p>如果需要详细了解<code>make-kpkg</code>的用法,可以查阅manual:</p>
<pre><code>man make-kpkg
</code></pre>
<h2>TIPS</h2>
<p>默认的config会编译很多模块,为了尽可能少的编译模块,在配置内核时,可以使用如下命令精简内核模块:</p>
<pre><code>make localmodconfig
</code></pre>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/06/01/linux-shi-zhong-he-ding-shi-qi/">Linux 时钟和定时器</a></h1>
<p class="meta">
<time datetime="2013-06-01T19:38:00+08:00" pubdate data-updated="true">Jun 1<span>st</span>, 2013</time>
| <a href="/blog/2013/06/01/linux-shi-zhong-he-ding-shi-qi/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><h2>时钟</h2>
<p>时钟这个东西,实际上是作为一种工具而存在,内核通过时钟来感知、管理时间。这里的时钟,更主要的还是<strong>软件上的概念</strong>,系统通过维护软件时钟来追踪时间。</p>
<h3>概念</h3>
<ol>
<li><strong>时钟中断</strong>:由硬件产生的电信号,一切的缘起。该中断产生时,内核通过特殊的中断处理程序进行处理。</li>
<li><strong>节拍率</strong>(tick rate):系统以某种频率(可编程)自行触发(hitting、popping)时钟中断(即系统定时器的频率)。</li>
<li><strong>节拍</strong>(tick):由于节拍率已知,系统当然也知道两次时钟中断之间所间隔的时间,这个时间就是时钟节拍。</li>
</ol>
<h3>再说节拍率:HZ</h3>
<p><strong>节拍率</strong>,即系统定时器的频率,在内核中通过<code>HZ</code>这个宏进行定义。在进行内核编程的时候,切记不要假设<code>HZ</code>不会发生变化,事实上,大多数体系结构的HZ都是可调的。</p>
<p><code>HZ</code>的理想取值:从2.5内核开始,这个取值在i386体系结构中就改为了<code>1000</code>(2.6.13版本后的内核,加入了250这个取值)。改变HZ的取值,对于操作系统而言,意味着改变时钟中断的频率:</p>
<p> <strong>增大HZ</strong>:提高时钟中断的频率,这带来的好处是,提高了时间驱动事件的解析度与精确度,内核定时器具有更高的频度与精确度(依赖内核定时器的系统调用也有了更精确的执行度,比如select、epoll等,这会带来很大的性能提升),时间相关的测量会更准确,内核抢占更准确,进程调度的响应更及时。</p>
<p>当然也会有负面影响:更高的中断频率,必然会导致系统消耗更多的资源来处理时钟中断(当然,就目前的主机来说,<code>1000</code>还是一个不错的取值)。</p>
<p>2.6的内核允许在编译的时候,选择不同的HZ取值,用户空间的<code>USER_HZ</code>,是根据内核的<code>HZ</code>进行了相应的转换。</p>
<p>最后顺便说一下,OS也是可以采取无节拍的实现的,但系统的开销会非常大。</p>
<h3>jiffies</h3>
<p>变量类型为<code>unsigned long volatile</code>,该变量记录了系统启动以来,产生的<code>tick</code>总数,<code>系统运行时间 = jiffies/HZ</code> 。</p>
<p>下面是几个典型运用:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='c'><span class='line'><span class="kt">unsigned</span> <span class="kt">long</span> <span class="n">timestamp</span> <span class="o">=</span> <span class="n">jiffies</span>
</span><span class='line'><span class="kt">unsigned</span> <span class="kt">long</span> <span class="n">nextTick</span> <span class="o">=</span> <span class="n">jiffies</span> <span class="o">+</span> <span class="mi">1</span>
</span><span class='line'><span class="kt">unsigned</span> <span class="kt">long</span> <span class="mi">5</span><span class="n">sLater</span> <span class="o">=</span> <span class="n">jiffies</span> <span class="o">+</span> <span class="mi">5</span><span class="o">*</span><span class="n">HZ</span>
</span></code></pre></td></tr></table></div></figure>
</div>
<footer>
<a rel="full-article" href="/blog/2013/06/01/linux-shi-zhong-he-ding-shi-qi/">Read on &rarr;</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/05/26/linuxshi-jie-li-de-shi-jian/">Linux世界里的时间</a></h1>
<p class="meta">
<time datetime="2013-05-26T20:33:00+08:00" pubdate data-updated="true">May 26<span>th</span>, 2013</time>
| <a href="/blog/2013/05/26/linuxshi-jie-li-de-shi-jian/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><p>通常,操作系统可以使用三种方法来表示系统的当前时间与日期:</p>
<ol>
<li>简单的一种方法就是直接用一个64位的计数器来对<strong>时钟滴答</strong>进行计数。</li>
<li>第二种方法就是用一个32位计数器来对<strong>秒</strong>进行计数,同时还用一个32位的辅助计数器对时钟滴答计数,直至累积到一秒为止。因为23<sup>2超过136年,因此这种方法直至22世纪都可以让系统工作得很好。</sup></li>
<li>第三种方法也是按<strong>时钟滴答</strong>进行计数,但是是相对于系统启动以来的滴答次数,而不是相对于某个确定的外部时刻;当读外部后备时钟(如RTC)或用户输入实际时间时,根据当前的滴答次数计算系统当前时间。</li>
</ol>
<h2>基本概念</h2>
<p>首先,有必要明确一些Linux内核时钟驱动中的基本概念。</p>
<h3>时钟周期的频率</h3>
<p>时钟周期(clock cycle)的频率:<code>8253/8254 PIT</code>的本质就是对由晶体振荡器产生的
时钟周期进行计数,<strong>晶体振荡器在1秒时间内产生的时钟脉冲个数就是时钟周期的频率</strong>。</p>
<p>Linux用宏<code>CLOCK_TICK_RATE</code>来表示<code>8254 PIT</code>的输入时钟脉冲的频率,该宏定义在<code>arch/x86/include/asm/timex.h</code>头文件中:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='c'><span class='line'><span class="p">.</span><span class="o">/</span><span class="n">arch</span><span class="o">/</span><span class="n">x86</span><span class="o">/</span><span class="n">include</span><span class="o">/</span><span class="n">asm</span><span class="o">/</span><span class="n">timex</span><span class="p">.</span><span class="n">h</span><span class="o">:</span><span class="mi">8</span><span class="o">:</span><span class="err">#</span><span class="n">define</span> <span class="n">CLOCK_TICK_RATE</span> <span class="n">PIT_TICK_RATE</span>
</span><span class='line'><span class="p">.</span><span class="o">/</span><span class="n">include</span><span class="o">/</span><span class="n">linux</span><span class="o">/</span><span class="n">timex</span><span class="p">.</span><span class="n">h</span><span class="o">:</span><span class="mi">153</span><span class="o">:</span><span class="err">#</span><span class="n">define</span> <span class="n">PIT_TICK_RATE</span> <span class="mi">1193182ul</span>
</span></code></pre></td></tr></table></div></figure>
<h3>时钟滴答</h3>
<p>时钟滴答(clock tick):当PIT通道0的计数器减到0值时,它就在<code>IRQ0</code>上产生一次时钟中断,也即一次<strong>时钟滴答</strong>。PIT通道0的计数器的初始值决定了要过多少时钟周期才产生一次时钟中断,因此也就决定了一次时钟滴答的时间间隔长度。</p>
<h3>时钟滴答的频率</h3>
<p>时钟滴答的频率(HZ):即<strong>1秒时间内PIT所产生的时钟滴答次数</strong>。类似地,这个值也是由PIT通道0的计数器初值决定的(反过来说,确定了时钟滴答的频率值后也就可以确定8254 PIT通道0的计数器初值)。</p>
<p>Linux内核用宏<code>HZ</code>来表示时钟滴答的频率,而且在不同的平台上<code>HZ</code>有不同的定义值。对于ALPHA和IA62平台HZ的值是1024,对于SPARC、MIPS、ARM和i386等平台<code>HZ</code>的值都是100。该宏在i386平台上的定义如下:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='c'><span class='line'><span class="cp">#ifndef HZ </span>
</span><span class='line'><span class="cp">#define HZ 100 </span>
</span><span class='line'><span class="cp">#endif </span>
</span></code></pre></td></tr></table></div></figure>
<p>根据<code>HZ</code>的值,我们也可以知道一次时钟滴答的具体时间间隔应该是(1000ms/HZ)=10ms。</p>
</div>
<footer>
<a rel="full-article" href="/blog/2013/05/26/linuxshi-jie-li-de-shi-jian/">Read on &rarr;</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/04/14/which-ming-ling-fen-xi/">Which 命令分析</a></h1>
<p class="meta">
<time datetime="2013-04-14T17:03:00+08:00" pubdate data-updated="true">Apr 14<span>th</span>, 2013</time>
| <a href="/blog/2013/04/14/which-ming-ling-fen-xi/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><h2>环境</h2>
<p>Linux 3.2.0-40-generic #64-Ubuntu SMP Mon Mar 25 21:22:10 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux</p>
<h3>which 命令的位置</h3>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>datawolf@datawolf-ThinkPad-Edge:~<span class="nv">$ </span>which -a which
</span><span class='line'>/usr/bin/which
</span><span class='line'>/bin/which
</span></code></pre></td></tr></table></div></figure>
<h3>分析两个which文件的类型</h3>
<p>通过以下shell命令可以看出,<code>/usr/bin/which</code>是一个指向<code>/bin/which</code>的符号链接。而<code>/bin/which</code>是一个shell脚本。</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>datawolf@datawolf-ThinkPad-Edge:~<span class="nv">$ </span>ls -al /usr/bin/which /bin/which
</span><span class='line'>-rwxr-xr-x 1 root root 946 Mar 30 2012 /bin/which
</span><span class='line'>lrwxrwxrwx 1 root root 10 Feb 21 16:23 /usr/bin/which -&gt; /bin/which
</span><span class='line'>datawolf@datawolf-ThinkPad-Edge:~<span class="nv">$ </span>file /usr/bin/which
</span><span class='line'>/usr/bin/which: symbolic link to <span class="sb">`</span>/bin/which<span class="err">&#39;</span>
</span><span class='line'>datawolf@datawolf-ThinkPad-Edge:~<span class="nv">$ </span>file /bin/which
</span><span class='line'>/bin/which: POSIX shell script, ASCII text executable
</span></code></pre></td></tr></table></div></figure>
</div>
<footer>
<a rel="full-article" href="/blog/2013/04/14/which-ming-ling-fen-xi/">Read on &rarr;</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/04/06/zi-dong-bei-fen-wang-zhan-he-shu-ju-ku-de-shelljiao-ben/">自动备份网站和数据库的shell脚本</a></h1>
<p class="meta">
<time datetime="2013-04-06T16:05:00+08:00" pubdate data-updated="true">Apr 6<span>th</span>, 2013</time>
| <a href="/blog/2013/04/06/zi-dong-bei-fen-wang-zhan-he-shu-ju-ku-de-shelljiao-ben/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><h2>备份网站内容</h2>
<p>我的网站是用xampp集成环境搭建的。为了方便迁移和备份数据。使用如下脚本对我网站内容进行备份。其中,<code>BACKUPDIR</code>指定备份文件的存储位置。
每一次备份的文件都用备份时系统的时间来进行唯一的命名,获取实际使用命令<code>date -I</code>。</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'><span class="c">#!/bin/bash</span>
</span><span class='line'>
</span><span class='line'><span class="c"># where to store the backup file</span>
</span><span class='line'><span class="nv">BACKUPDIR</span><span class="o">=</span><span class="s2">&quot;/home/wanglong&quot;</span>
</span><span class='line'>
</span><span class='line'><span class="nv">DATE</span><span class="o">=</span><span class="sb">`</span>date -I<span class="sb">`</span>
</span><span class='line'><span class="o">[</span> ! -d <span class="nv">$BACKUPDIR</span> <span class="o">]</span> <span class="o">&amp;&amp;</span> mkdir -p <span class="nv">$BACKUPDIR</span>
</span><span class='line'><span class="nb">cd</span> /opt/lampp
</span><span class='line'>tar zcf <span class="nv">$BACKUPDIR</span>/htdocs.<span class="nv">$DATE</span>.tar.gz htdocs
</span></code></pre></td></tr></table></div></figure>
<h2>备份mysql数据库</h2>
<p>备份数据库前,需要指定一下shell变量,包括mysql数据库的用户名、密码、运行数据库的主机和数据库相关命令的位置。</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'><span class="nv">MYUSER</span><span class="o">=</span><span class="s2">&quot;user&quot;</span>
</span><span class='line'><span class="nv">MYPASS</span><span class="o">=</span><span class="s2">&quot;password&quot;</span>
</span><span class='line'><span class="nv">HOST</span><span class="o">=</span><span class="s2">&quot;localhost&quot;</span>
</span><span class='line'><span class="nv">BACKUPDIR</span><span class="o">=</span><span class="s2">&quot;/home/wanglong&quot;</span>
</span><span class='line'><span class="nv">MYSQL</span><span class="o">=</span><span class="s2">&quot;/opt/lampp/bin/mysql&quot;</span>
</span><span class='line'><span class="nv">MYSQL_DUMP</span><span class="o">=</span><span class="s2">&quot;/opt/lampp/bin/mysqldump&quot;</span>
</span></code></pre></td></tr></table></div></figure>
<p>完整shell脚本如下,首先将所有的数据库作为一个整体进行备份,然后对每一个数据库分别进行了备份。</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'><span class="c">#!/bin/bash</span>
</span><span class='line'>
</span><span class='line'><span class="nv">MYUSER</span><span class="o">=</span><span class="s2">&quot;user&quot;</span>
</span><span class='line'><span class="nv">MYPASS</span><span class="o">=</span><span class="s2">&quot;password&quot;</span>
</span><span class='line'><span class="nv">HOST</span><span class="o">=</span><span class="s2">&quot;localhost&quot;</span>
</span><span class='line'><span class="nv">BACKUPDIR</span><span class="o">=</span><span class="s2">&quot;/home/wanglong&quot;</span>
</span><span class='line'><span class="nv">MYSQL</span><span class="o">=</span><span class="s2">&quot;/opt/lampp/bin/mysql&quot;</span>
</span><span class='line'><span class="nv">MYSQL_DUMP</span><span class="o">=</span><span class="s2">&quot;/opt/lampp/bin/mysqldump&quot;</span>
</span><span class='line'><span class="nv">DATE</span><span class="o">=</span><span class="sb">`</span>date -I<span class="sb">`</span>
</span><span class='line'>
</span><span class='line'><span class="o">[</span> ! -d <span class="nv">$BACKUPDIR</span>/<span class="nv">$DATE</span> <span class="o">]</span> <span class="o">&amp;&amp;</span> mkdir -p <span class="nv">$BACKUPDIR</span>/<span class="nv">$DATE</span>
</span><span class='line'>
</span><span class='line'><span class="c"># backup all databases in a file</span>
</span><span class='line'><span class="nv">$MYSQL_DUMP</span> -u<span class="nv">$MYUSER</span> -p<span class="nv">$MYPASS</span> -h<span class="nv">$HOST</span> --all-databases &gt; <span class="nv">$BACKUPDIR</span>/<span class="nv">$DATE</span>/all-databases.sql
</span><span class='line'>
</span><span class='line'><span class="c"># backup each database in separate file</span>
</span><span class='line'><span class="nv">DBS</span><span class="o">=</span><span class="sb">`</span><span class="nv">$MYSQL</span> -u<span class="nv">$MYUSER</span> -p<span class="nv">$MYPASS</span> -Bse <span class="s2">&quot;show databases&quot;</span>|grep -v <span class="s2">&quot;information_schema&quot;</span> | grep -v <span class="s2">&quot;performance_schema&quot;</span>|grep -v <span class="s2">&quot;Database&quot;</span><span class="sb">`</span>
</span><span class='line'><span class="k">for </span>db_name in <span class="nv">$DBS</span>
</span><span class='line'> <span class="k">do</span>
</span><span class='line'> <span class="nv">$MYSQL_DUMP</span> -u<span class="nv">$MYUSER</span> -p<span class="nv">$MYPASS</span> -h<span class="nv">$HOST</span> <span class="nv">$db_name</span> &gt; <span class="nv">$BACKUPDIR</span>/<span class="nv">$DATE</span>/<span class="nv">$db_name</span>.sql
</span><span class='line'> <span class="k">done</span>
</span><span class='line'>
</span><span class='line'><span class="nb">cd</span> <span class="nv">$BACKUPDIR</span>
</span><span class='line'>tar zcf mysql.<span class="nv">$DATE</span>.tar.gz <span class="nv">$DATE</span> <span class="o">&amp;&amp;</span> rm -rf <span class="nv">$BACKUPDIR</span>/<span class="nv">$DATE</span>
</span></code></pre></td></tr></table></div></figure>
<h2>自动执行脚本</h2>
<p>计划每周自动备份一次网站和数据库,所以需要将上述脚本拷贝到目录<code>/etc/cron.weekly/</code>中。</p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/04/06/using-bat-file-to-run-python-program-on-windows/">Using Bat File to Run Python Program on Windows</a></h1>
<p class="meta">
<time datetime="2013-04-06T15:56:00+08:00" pubdate data-updated="true">Apr 6<span>th</span>, 2013</time>
| <a href="/blog/2013/04/06/using-bat-file-to-run-python-program-on-windows/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><h2>在windows下批处理文件中调用python</h2>
<p>由于python的变量的问题,不能在批处理文件<code>somefile.bat</code>正确使用<code>python somefile.py</code>来执行python程序。</p>
<p>所以需要在bat文件中临时修改python环境变量。</p>
<p>最终的bat文件如下:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
</pre></td><td class='code'><pre><code class='bat'><span class='line'><span class="p">@</span><span class="k">echo</span> <span class="k">off</span>
</span><span class='line'><span class="k">set</span> <span class="nv">PYPATH</span><span class="o">=</span>C:\Python<span class="m">27</span>;C:\Python<span class="m">27</span>\Lib;C:\Python<span class="m">27</span>\libs;C:\Python<span class="m">27</span>\Tools\Scripts;
</span><span class='line'><span class="k">set</span> <span class="nv">path</span><span class="o">=</span><span class="nv">%PYPATH%</span>;<span class="nv">%path%</span>
</span><span class='line'><span class="p">@</span><span class="k">echo</span> <span class="k">on</span>
</span><span class='line'>
</span><span class='line'>python get_all_problems.py
</span><span class='line'>python get_need_solved.py
</span><span class='line'>python sort_problems.py
</span><span class='line'>
</span><span class='line'><span class="k">pause</span>
</span></code></pre></td></tr></table></div></figure>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/04/04/ubuntuxia-an-zhuang-eclipsede-could-not-load-swt-librarywen-ti/">Ubuntu下安装eclipse的Could Not Load SWT Library问题</a></h1>
<p class="meta">
<time datetime="2013-04-04T15:16:00+08:00" pubdate data-updated="true">Apr 4<span>th</span>, 2013</time>
| <a href="/blog/2013/04/04/ubuntuxia-an-zhuang-eclipsede-could-not-load-swt-librarywen-ti/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><h2>Description</h2>
<p>版本:Ubuntu 12.04, Eclipse3.7.2-1, Oracle Java 1.6</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'><span class="nv">$ </span>sudo apt-get install eclipse
</span></code></pre></td></tr></table></div></figure>
<h2>Question</h2>
<p>安装后打开eclipse,提示出错</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>An error has occurred. See the log file /home/datawolf/.eclipse/org.eclipse.platform_3.7.0_155965261/configuration/1365058671830.log.</span></code></pre></td></tr></table></div></figure>
<p>打开log文件,看到下面的错误</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
<span class='line-number'>38</span>
<span class='line-number'>39</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>!SESSION 2013-04-04 14:57:51.666 -----------------------------------------------
</span><span class='line'>eclipse.buildId=I20110613-1736
</span><span class='line'>java.version=1.6.0_37
</span><span class='line'>java.vendor=Sun Microsystems Inc.
</span><span class='line'>BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
</span><span class='line'>Command-line arguments: -os linux -ws gtk -arch x86_64
</span><span class='line'>
</span><span class='line'>!ENTRY org.eclipse.osgi 4 0 2013-04-04 14:57:53.033
</span><span class='line'>!MESSAGE Application error
</span><span class='line'>!STACK 1
</span><span class='line'>java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
</span><span class='line'> no swt-gtk-3740 in java.library.path
</span><span class='line'> no swt-gtk in java.library.path
</span><span class='line'> Can't load library: /home/datawolf/.swt/lib/linux/x86_64/libswt-gtk-3740.so
</span><span class='line'> Can't load library: /home/datawolf/.swt/lib/linux/x86_64/libswt-gtk.so
</span><span class='line'>
</span><span class='line'> at org.eclipse.swt.internal.Library.loadLibrary(Library.java:285)
</span><span class='line'> at org.eclipse.swt.internal.Library.loadLibrary(Library.java:194)
</span><span class='line'> at org.eclipse.swt.internal.C.&lt;clinit&gt;(C.java:21)
</span><span class='line'> at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63)
</span><span class='line'> at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54)
</span><span class='line'> at org.eclipse.swt.widgets.Display.&lt;clinit&gt;(Display.java:132)
</span><span class='line'> at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:695)
</span><span class='line'> at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:161)
</span><span class='line'> at org.eclipse.ui.internal.ide.application.IDEApplication.createDisplay(IDEApplication.java:153)
</span><span class='line'> at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:95)
</span><span class='line'> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
</span><span class='line'> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
</span><span class='line'> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
</span><span class='line'> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
</span><span class='line'> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
</span><span class='line'> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
</span><span class='line'> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
</span><span class='line'> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
</span><span class='line'> at java.lang.reflect.Method.invoke(Method.java:597)
</span><span class='line'> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
</span><span class='line'> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
</span><span class='line'> at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
</span><span class='line'> at org.eclipse.equinox.launcher.Main.main(Main.java:1386)</span></code></pre></td></tr></table></div></figure>
<h2>Solution</h2>
<p>把相关文件拷贝到<code>~/.swt/lib/linux/x86_64</code>下即可</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'><span class="nv">$ </span>cp /usr/lib/jni/libswt-*3740.so ~/.swt/lib/linux/x86_64
</span></code></pre></td></tr></table></div></figure>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/04/03/how-to-install-sun-jdk-6-on-ubuntu-linux/">How to Install Sun Jdk 6 on Ubuntu Linux</a></h1>
<p class="meta">
<time datetime="2013-04-03T17:12:00+08:00" pubdate data-updated="true">Apr 3<span>rd</span>, 2013</time>
| <a href="/blog/2013/04/03/how-to-install-sun-jdk-6-on-ubuntu-linux/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><h2>下载相应的版本</h2>
<p><a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk6u37-downloads-1859587.html">下载地址</a>下载相应的版本,32位就x86,64位就x64,我下载的是jdk-6u37-linux-x64.bin;</p>
<h2>安装</h2>
<p>1、创建安装目录</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'><span class="nv">$ </span>sudo mkdir /usr/java
</span><span class='line'><span class="nv">$ </span><span class="nb">cd</span> /usr/java/
</span></code></pre></td></tr></table></div></figure>
<p>2、拷贝下载好的jdk到安装目录</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'><span class="nv">$ </span>sudo mv ~/jdk-6u37-linux-x64.bin ./
</span></code></pre></td></tr></table></div></figure>
<p>3、安装</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'><span class="nv">$ </span>sudo ./jdk-6u37-linux-x64.bin
</span></code></pre></td></tr></table></div></figure>
<p>安装完后,会在<code>/usr/java</code>目录下多出一个<code>jdk_1.6.0_37</code>的目录。</p>
<h2>配置</h2>
<p>1、配置环境变量</p>
<p>编辑<code>/etc/bashrc</code>,添加如下内容</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>JAVA_HOME=/usr/java/jdk1.6.0_37
</span><span class='line'>PATH=$PATH:$JAVA_HOME/bin
</span><span class='line'>CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$CLASSPATH
</span><span class='line'>export JAVA_HOME PATH CLASSPATH</span></code></pre></td></tr></table></div></figure>
<p>2、使环境变量生效</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'><span class="nv">$ </span><span class="nb">source</span> /etc/bashrc
</span></code></pre></td></tr></table></div></figure>
<p>3、替换ubuntu默认的jdk</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'><span class="nv">$ </span>sudo update-alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_37/bin/java 999
</span><span class='line'><span class="nv">$ </span>sudo update-alternatives --install /usr/bin/javac javac /usr/java/jdk1.6.0_37/bin/javac 999
</span><span class='line'><span class="nv">$ </span>sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/java/jdk1.6.0_37/bin/javadoc 999
</span><span class='line'>
</span><span class='line'><span class="c">#以下三个命令会让你选择,选择刚安装好的版本就行了</span>
</span><span class='line'><span class="nv">$ </span>sudo update-alternatives --config java
</span><span class='line'><span class="nv">$ </span>sudo update-alternatives --config javac
</span><span class='line'><span class="nv">$ </span>sudo update-alternatives --config javadoc
</span></code></pre></td></tr></table></div></figure>
<p>4、检查一下,是否正确</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'><span class="nv">$ </span>ls -lh /etc/alternatives/java*
</span></code></pre></td></tr></table></div></figure>
<p>结果如下:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>lrwxrwxrwx 1 root root 30 Apr 3 17:27 /etc/alternatives/java -&gt; /usr/java/jdk1.6.0_37/bin/java
</span><span class='line'>lrwxrwxrwx 1 root root 31 Apr 3 17:28 /etc/alternatives/javac -&gt; /usr/java/jdk1.6.0_37/bin/javac
</span><span class='line'>lrwxrwxrwx 1 root root 33 Apr 3 17:28 /etc/alternatives/javadoc -&gt; /usr/java/jdk1.6.0_37/bin/javadoc</span></code></pre></td></tr></table></div></figure>
</div>
</article>
<div class="pagination">
<a class="prev" href="/blog/page/2/">&larr; Older</a>
<a href="/blog/archives">Blog Archives</a>
</div>
</div>
<aside class="sidebar">
</aside>
</div>
</div>
<footer role="contentinfo"><p>
Copyright &copy; 2015 - datawolf -
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a></span>
</p>
</footer>
<script type="text/javascript">
var disqus_shortname = 'datawolf';
var disqus_script = 'count.js';
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script;
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
}());
</script>
</body>
</html>
Something went wrong with that request. Please try again.