<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>zendz's blog</title>
  <link rel="alternate" type="text/html" href="http://www.howforge.com/blog/zendz"/>
  <link rel="self" type="application/atom+xml" href="http://www.howforge.com/blog/6/atom/feed"/>
  <id>http://www.howforge.com/blog/6/atom/feed</id>
  <updated>2005-08-24T11:04:27+07:00</updated>
  <entry>
    <title>การลง Tomcat บน CentOS</title>
    <link rel="alternate" type="text/html" href="http://www.howforge.com/tomcat-centos" />
    <id>http://www.howforge.com/tomcat-centos</id>
    <published>2006-03-31T10:06:39+07:00</published>
    <updated>2006-03-31T13:07:25+07:00</updated>
    <author>
      <name>zendz</name>
    </author>
    <category term="IT" />
    <category term="Linux" />
    <category term="Software" />
    <category term="Thai" />
    <category term="Tips and Tricks" />
    <summary type="html"><![CDATA[การลง tomcat บน linux นั้นบางครั้งเป้นเรื่องที่น่าปวดหัวเพราะเราจะต้องมานั่ง install หรือ compile ให้มันวุ่นวายหรือหากเอา binary tarball มาลง configuration ก็ดูกระจัดกระจายน่าปวดหัว หาก distro ไหนที่ support ระบบ package management มันก็สะดวกหน่อยในการ Install หรือจัดการ เพราะพวกนี้จะถูกจัดเก็บค่อนข้างเป็นที่เป็นทาง

CentOS ก็คือหนึ่งในนั้นที่มีระบบ package management ที่สะดวกโดยใช้ yum หรือ up2date command ในการใช้งาน (base on RPM) ในครั้งนี้เราจะมาพูดถึงการ install tomcat5 บน CentOS ซึ่งเนื่องจาก เอกสารดั่งเดิมเป็นภาษาอังกฤษ ซึ่งบางคนคงจะไม่อยากอ่านหรือนั่งแปล ผมจึงยกบางส่วนและเสริมรายละเอียดบางส่วนเข้าไป เพื่อให้เข้าใจมากขึ้น และอาจจะง่ายมากขึ้น หรือเปล่า??    ]]></summary>
    <content type="html"><![CDATA[การลง tomcat บน linux นั้นบางครั้งเป้นเรื่องที่น่าปวดหัวเพราะเราจะต้องมานั่ง install หรือ compile ให้มันวุ่นวายหรือหากเอา binary tarball มาลง configuration ก็ดูกระจัดกระจายน่าปวดหัว หาก distro ไหนที่ support ระบบ package management มันก็สะดวกหน่อยในการ Install หรือจัดการ เพราะพวกนี้จะถูกจัดเก็บค่อนข้างเป็นที่เป็นทาง

CentOS ก็คือหนึ่งในนั้นที่มีระบบ package management ที่สะดวกโดยใช้ yum หรือ up2date command ในการใช้งาน (base on RPM) ในครั้งนี้เราจะมาพูดถึงการ install tomcat5 บน CentOS ซึ่งเนื่องจาก เอกสารดั่งเดิมเป็นภาษาอังกฤษ ซึ่งบางคนคงจะไม่อยากอ่านหรือนั่งแปล ผมจึงยกบางส่วนและเสริมรายละเอียดบางส่วนเข้าไป เพื่อให้เข้าใจมากขึ้น และอาจจะง่ายมากขึ้น หรือเปล่า??<!--break-->

 โดยในขั้นแรก system ของเราต้องสามารถ compile rpm ได้และต้องมี repository บางส่วนที่ต้องเพิ่มเติม ในที่นี้ผมขอแนะนำ plugin บางตัวให้คือ yum-plugin-fastestmirror ซึ่งจะช่วยหาว่า mirror ที่ใดใกล้ที่สุดและ download มาจากที่นั้น  

ให้ทำการติดตั้ง plugin ตัวนี้กันก่อน โดยสั่ง

<code language="bash">[root@znix ~]# yum install yum-plugin-fastestmirror
Setting up Install Process
Setting up repositories
csgfs                     100% |=========================|  951 B    00:00
dag                       100% |=========================| 1.1 kB    00:00
jpackage-generic-nonfree  100% |=========================|  951 B    00:00
jpackage-rhel             100% |=========================|  951 B    00:00
update                    100% |=========================|  951 B    00:00
jpackage-generic          100% |=========================|  951 B    00:00
base                      100% |=========================| 1.1 kB    00:00
addons                    100% |=========================|  951 B    00:00
extras                    100% |=========================| 1.1 kB    00:00
Reading repository metadata in from local files
primary.xml.gz            100% |=========================| 351 kB    00:07
jpackage-g: ################################################## 1529/1529
Added 0 new packages, deleted 0 old in 1.12 seconds
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package yum-plugin-fastestmirror.noarch 0:0.2.4-3.c4 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 yum-plugin-fastestmirror  noarch     0.2.4-3.c4       extras             13 k

Transaction Summary
=============================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 13 k
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: yum-plugin-fastestmirror     ######################### [1/1]

Installed: yum-plugin-fastestmirror.noarch 0:0.2.4-3.c4
Complete!
</code>

ไม่ต้องกังวลหากหน้าตาไม่เหมือน เพราะตัวอย่างผมเพิ่ม repository เข้าไป เพื่อใช้งานของผม เราไป install rpmbuild มาใช้กันดีกว่า

<code language="bash">[root@znix ~]# yum -y install rpm-build
 --- CUT ---
Installed: rpm-build.noarch 0:4.3.3-13_nonptl
Complete!
</code>

เนื่องจาก โดยปกติแล้วตัว CentOS ไม่มี repository ที่มี java package ให้ลง ผมแนะนำว่าควรไปใช้ของทาง <a href="http://www.jackage.org">JPackage</a> มาใช้งาน โดยเราเพิ่ม repository ได้โดยทำดังนี้

<ol>
<li>ให้สั่ง ดังนี้ <code language="bash">[root@znix ~]# cd /etc/yum.repos.d/
[root@znix yum.repos.d]# vi jpackage.repo</code></li><p>&nbsp;</p>
<li>ในตัว file ให้เพิ่ม data เข้าไปดังนี้ <code>[jpackage-generic]
name=JPackage (free), generic
mirrorlist=http://www.jpackage.org/jpackage_generic.txt
failovermethod=priority
gpgcheck=1
gpgkey=http://www.jpackage.org/jpackage.asc
enabled=1

[jpackage-rhel]
name=JPackage (free) for Red Hat Enterprise Linux $releasever
mirrorlist=http://www.jpackage.org/jpackage_rhel-$releasever.txt
failovermethod=priority
gpgcheck=1
gpgkey=http://www.jpackage.org/jpackage.asc
enabled=1

[jpackage-generic-nonfree]
name=JPackage (non-free), generic
mirrorlist=http://www.jpackage.org/jpackage_generic_nonfree.txt
failovermethod=priority
gpgcheck=1
gpgkey=http://www.jpackage.org/jpackage.asc
enabled=1</code>จากนั้นก็ save แล้วออกมาซะ</li><p>&nbsp;</p>
<li>ทำการ Import gpg key ของ jpackage เพื่อ check package ที่ได้มาถูกต้องหรือไม่ โดยสั่งดังนี้ <code language="bash">[root@znix yum.repos.d]# rpm --import http://www.jpackage.org/jpackage.asc</code></li><p>&nbsp;</p>
<li>ทำการ download files บางอย่างที่จำเป็นต้องใช้คือ <a href="http://javashoplm.sun.com/ECom/docs/Welcome.jsp?StoreId=22&PartDetailId=jdk-1.5.0_06-oth-JPR&SiteId=JSC&TransactionId=noreg">jdk-1_5_0_06-linux-i586.bin</a> ,<a href="http://javashoplm.sun.com/ECom/docs/Welcome.jsp?StoreId=22&PartDetailId=7089-jta-1.0.1B-mr-class-oth-JSpec&SiteId=JSC&TransactionId=noreg">jta-1_0_1B-classes.zip</a> และ <a href="http://javashoplm.sun.com/ECom/docs/Welcome.jsp?StoreId=22&PartDetailId=7088-jta-1.0.1B-mr-doc-oth-JSpec&SiteId=JSC&TransactionId=noreg">jta-1_0_1B-doc.zip</a> จาก sun ในที่นี้ผมจะอ้าง version ตามที่ผมใช้อยู่ขณะนี้ โดยทำการ download file ดังกล่าวไปไว้ที่ /usr/src/redhat/SOURCES</li><p>&nbsp;</p>
<li>หลังจาก download เรียบร้อยแล้วให้ทำการ download file ดังต่อไปนี้<ul>
<li>jta src package จาก http://www.jpackage.org/rpm.php?id=1482</li>
<li>java-1.5.0-sun src package จาก http://www.jpackage.org/rpm.php?id=3366</li></ul></li><p>&nbsp;</p>
<li>จากนั้นทำการ build ให้มันเป็น binary ซะ โดยสั่งดังนี้ <code language="bash">[root@znix ~]# rpmbuild --rebuild java-1.5.0-sun-1.5.0.06-1jpp.nosrc.rpm
[root@znix ~]# rpmbuild -ivh /usr/src/redhat/RPMS/i586/java-1.5.0-sun-1.5.0.06-1jpp.i586.rpm
[root@znix ~]# rpmbuild -ivh /usr/src/redhat/RPMS/i586/java-1.5.0-sun-devel-1.5.0.06-1jpp.i586.rpm
[root@znix ~]# rpmbuild --rebuild jta-1.0.1-0.b.4jpp.nosrc.rpm
[root@znix ~]# rpmbuild -ivh /usr/src/redhat/RPMS/noarch/jta-1.0.1-0.b.4jpp.noarch.rpm
</code></li><p>&nbsp;</p>
<li>จากขั้นตอนดังข้างต้น เราก็สามารถลง tomcat binary package ได้แล้ว โดยสั่งง่ายๆ เลย <code language="bash">[root@znix ~]# yum install tomcat5</code>
โดย yum จะทำการ download package ที่จำเป็นต่อการใช้งานมาลงให้เรียบร้อย</li>
</ol>

โดย package ที่ต้องการเพิ่มเติมนั้นจะถูกเก็บไว้ที่ /usr/share/java ในรูปของ .jar file โดยที่ในอนาคตหากเรามีการ develop java applciation เราสามารถอ้างอิงได้ที่ path นี้ได้เลยง่ายต่อการใช้งาน หรือหากมีการ update/upgrade version ของ java lib นั้นก็สามารถทำได้สะดวก เพียงสั่ง yum update 

แต่ก่อนสั่ง yum update ทุกครั้งควร yum check-update ก่อนทุกครั้ง เพื่อจะได้ตรวจสอบก่อนว่ามี package ใด ที่ Update/upgrade แล้วกระทบต่อระบบโดยรวมหรือไม่


ครั้งหน้าจะมาต่อด้วยการทำยังไง ถึงจะ Integrate Tomcat เข้าไปใช้งานร่วมกับ Apache ได้ยังไง วิธีทำ ง่ายๆ ไม่ยุ่งยากแล้วพบกันใหม่


<strong><u>Refer</u></strong>
Original Document from http://www.tummy.com/Community/Articles/tomcat-centos/
    ]]></content>
  </entry>
  <entry>
    <title>The CentOS 4.3 has released!!!</title>
    <link rel="alternate" type="text/html" href="http://www.howforge.com/the-centos-4-3-has-released" />
    <id>http://www.howforge.com/the-centos-4-3-has-released</id>
    <published>2006-03-22T11:27:05+07:00</published>
    <updated>2006-03-23T12:33:15+07:00</updated>
    <author>
      <name>zendz</name>
    </author>
    <category term="Announcement" />
    <category term="English" />
    <category term="IT" />
    <category term="Linux" />
    <category term="News" />
    <summary type="html"><![CDATA[<p>The CentOS 4 has released new major version to 4.3. Now availability for i386, x86_64 and ia64 and s390, s390x, alpha, ppc and sparc inprogress build pkgs for announced later.</p><p>This's version is upgrade and update some features.</p><ul><li>Including yum-plugin-fastestmirror into released (CentOS-Base.repo) <br /></li><li>Add and support Frysk, InfiniBand Architecture (IBA), and z/VM hypervisor.</li><li>Update security some packages.</li></ul><p>The Frysk is analysis tools (RH call execution-analysis technology) some as DTrace project of Sun MicroSystem. But the Dtrace support (solaris,opensolaris) only. If you want to know Frysk or Dtrace please follow link in below.</p>    ]]></summary>
    <content type="html"><![CDATA[<p>The CentOS 4 has released new major version to 4.3. Now availability for i386, x86_64 and ia64 and s390, s390x, alpha, ppc and sparc inprogress build pkgs for announced later.</p><p>This's version is upgrade and update some features.</p><ul><li>Including yum-plugin-fastestmirror into released (CentOS-Base.repo) <br /></li><li>Add and support Frysk, InfiniBand Architecture (IBA), and z/VM hypervisor.</li><li>Update security some packages.</li></ul><p>The Frysk is analysis tools (RH call execution-analysis technology) some as DTrace project of Sun MicroSystem. But the Dtrace support (solaris,opensolaris) only. If you want to know Frysk or Dtrace please follow link in below.</p><blockquote><ul><li>http://www.howforge.com/dtrace-systemtab (Thai version in my blog. i'm talking about this.)</li><li>http://sourceware.org/frysk/ <br /></li><li>https://rhn.redhat.com/errata/RHEA-2006-0130.html</li><li>http://www.sun.com/bigadmin/content/dtrace/</li><li>http://www.brendangregg.com/dtrace.html&nbsp;&nbsp; &lt;&lt; may be thailand reginal can't go (Block from ICT cyberclean project <img border="0" alt="Yell" src="modules/tinymce/tinymce/jscripts/tiny_mce/plugins/emotions/images/smiley-yell.gif" />)<br /></li><li>http://opensolaris.org/os/community/dtrace/&nbsp;</li></ul></blockquote><p>&nbsp;<br />The InfiniBand Architecture (IBA) is technology from intel. It increase performance on Intel&reg; Xeon&trade; and Intel&reg; Itanium&reg; processor platfrom</p><blockquote><ul><li>http://www.intel.com/technology/infiniband/<br /></li><li>http://www.oreillynet.com/pub/a/network/2002/02/04/windows.html</li></ul></blockquote><p>And z/VM hypervisor are VM technology base on IBM server platfrom only. </p><p>&nbsp;</p><p>If you want/need use VM technology in another platfrom. You wait for Xen technology. I hear some information the RH and Debian comminity include the Xen technology into own distro. (FC5 include Xen technology into kernel <img border="0" alt="Laughing" src="modules/tinymce/tinymce/jscripts/tiny_mce/plugins/emotions/images/smiley-laughing.gif" />) If you want use Xen before the others. It's need patch the kernel. <img border="0" alt="Frown" src="modules/tinymce/tinymce/jscripts/tiny_mce/plugins/emotions/images/smiley-frown.gif" /></p><p>&nbsp;</p>    ]]></content>
  </entry>
  <entry>
    <title>phpMyAdmin released new version!!.</title>
    <link rel="alternate" type="text/html" href="http://www.howforge.com/phpmyadmin-released-new-version" />
    <id>http://www.howforge.com/phpmyadmin-released-new-version</id>
    <published>2006-03-22T10:55:06+07:00</published>
    <updated>2006-03-22T10:55:06+07:00</updated>
    <author>
      <name>zendz</name>
    </author>
    <category term="Announcement" />
    <category term="English" />
    <category term="IT" />
    <category term="News" />
    <category term="PHP" />
    <category term="Software" />
    <summary type="html"><![CDATA[ <p>I found the phpMyAdmin project is released new major released version <span class="version">2.8.0.2. It change to improvement features.<br /> </span></p> <p>The new featu    ]]></summary>
    <content type="html"><![CDATA[ <p>I found the phpMyAdmin project is released new major released version <span class="version">2.8.0.2. It change to improvement features.<br /> </span></p> <p>The new featu<!--break-->re in phpMyAdmin</p> <ol> <li>Easy to configuraiton from webbase eg. http://yourdomain.tld/phpMyAdmin/scripts/setup.php</li> <li>Support configuration memmory limit in export/import fuction.</li> <li>Support mysqli extension.</li> <li>Can manage web layout if you want.</li> <li>and etc...</li> </ol> Please see detail in Released notes click <a target="_blank" href="http://www.phpmyadmin.net/home_page/downloads.php?relnotes=0">here</a><br /> &nbsp;<br />     ]]></content>
  </entry>
  <entry>
    <title>วิธีง่ายๆ ในการใช้งาน vim syntax color</title>
    <link rel="alternate" type="text/html" href="http://www.howforge.com/vim-syntax-color" />
    <id>http://www.howforge.com/vim-syntax-color</id>
    <published>2006-03-20T15:20:26+07:00</published>
    <updated>2006-03-25T15:17:37+07:00</updated>
    <author>
      <name>zendz</name>
    </author>
    <category term="*NIX" />
    <category term="IT" />
    <category term="Linux" />
    <category term="Software" />
    <category term="Thai" />
    <category term="Tips and Tricks" />
    <summary type="html"><![CDATA[บางครั้งคุณอาจจะรู้สึกเบื่อหน่ายในการแก้ code บางอย่างใน terminal ของ *nix หรือ linux เนื่องจากมันไม่มีสีแยกแยะให้แก้ไขได้ง่ายๆ ดังนั้นเรามาลองทำกันไหม ว่ามันทำได้อย่างไรบ้าง (<em>ขออ้างอิงจาก linux เป็นหลัก และบาง distro เท่านั้น ในที่นี้ขออ้างอิงจาก centos ในเรื่องของ pkg</em>)
    ]]></summary>
    <content type="html"><![CDATA[บางครั้งคุณอาจจะรู้สึกเบื่อหน่ายในการแก้ code บางอย่างใน terminal ของ *nix หรือ linux เนื่องจากมันไม่มีสีแยกแยะให้แก้ไขได้ง่ายๆ ดังนั้นเรามาลองทำกันไหม ว่ามันทำได้อย่างไรบ้าง (<em>ขออ้างอิงจาก linux เป็นหลัก และบาง distro เท่านั้น ในที่นี้ขออ้างอิงจาก centos ในเรื่องของ pkg</em>)

โดยปกติแล้ว linux จะมีการลง vim มให้อยู่แล้วหากใครลงแบบ minimal หรือแบบน้อยที่สุดนั้น ตัว vim จะไม่มี syntax color ให้ใช้ เนื่องจากตัว pkg นั้นเป็น vim-minimal (<em>ชื่อมันก็บอกอยู่นั้นละ</em>) ดังนั้นเราจำเป็นต้องมีการลงเพิ่มเติม โดยสามารถทำได้ง่ายๆ โดยสั่งดังนี้

<code language="bash">yum -y install vim-enhanced</code>

จากนั้น ให้ทำการ logout และ login ใหม่ หรือสั่ง

<code language="bash">source /etc/profile</code>

เพียงเท่านี้เราสามารถใช้งาน vim แบบมี syntax color ได้แล้ว แต่บางครั้งเราใช้งานมันอาจจะไม่สะดวกเท่าไร เช่นมีการลง mod_jk หรืออะไรก็ตาม บางครั้งมันจะไม่ขึ้น syntax ให้ต้องมาสั่งเอาเอง เรามีวิธีสะดวกกว่านั้น โดยไปแก้ที่ file /usr/share/vim/vim63/filetype.vim

ยกตัวอย่างแก้ apache syntax แก้ตามนี้

<pre>" Apache config file
   au BufNewFile,BufRead httpd.conf*,srm.conf*,access.conf*,.htaccess,apache.conf*,auth_mysql.conf*,auth_pgsql.conf \
   *,ssl.conf*,perl.conf*,php.conf*,python.conf*,squirrelmail.conf* <span style="color: #ff6600"><strong>/etc/httpd/*/*.conf</strong></span> setf apache</pre>

ดังตัวอย่าง ก็สามารถตั้งให้ file ที่อยู่ใน /etc/httpd/*/*.conf ใช้ syntax apache โดยอัตโนมัติ    ]]></content>
  </entry>
  <entry>
    <title>Cluster Suite 4 and Global File System 6.1 for CentOS-4</title>
    <link rel="alternate" type="text/html" href="http://www.howforge.com/cluster-suite-4-and-global-file-system-6-1-for-centos-4" />
    <id>http://www.howforge.com/cluster-suite-4-and-global-file-system-6-1-for-centos-4</id>
    <published>2006-03-15T12:29:03+07:00</published>
    <updated>2006-03-15T12:29:03+07:00</updated>
    <author>
      <name>zendz</name>
    </author>
    <category term="*NIX" />
    <category term="Announcement" />
    <category term="Cluster Computing" />
    <category term="English" />
    <summary type="html"><![CDATA[<p>This's old news. I found some announcement from centos offical site. The centos 4 is released Cluster Suite 4 (CS) and Global File System 6.1 (GFS) for support i386 and x86_64 architecture</p><p>You can find more information and documents in http://www.centos.org/modules/news/article.php?storyid=108</p><p>&nbsp;<img border="0" alt="Wink" src="modules/tinymce/tinymce/jscripts/tiny_mce/plugins/emotions/images/smiley-wink.gif" /></p>    ]]></summary>
    <content type="html"><![CDATA[<p>This's old news. I found some announcement from centos offical site. The centos 4 is released Cluster Suite 4 (CS) and Global File System 6.1 (GFS) for support i386 and x86_64 architecture</p><p>You can find more information and documents in http://www.centos.org/modules/news/article.php?storyid=108</p><p>&nbsp;<img border="0" alt="Wink" src="modules/tinymce/tinymce/jscripts/tiny_mce/plugins/emotions/images/smiley-wink.gif" /></p>    ]]></content>
  </entry>
  <entry>
    <title>Dtrace และ SystemTap</title>
    <link rel="alternate" type="text/html" href="http://www.howforge.com/dtrace-systemtab" />
    <id>http://www.howforge.com/dtrace-systemtab</id>
    <published>2006-02-27T12:16:59+07:00</published>
    <updated>2006-03-22T12:38:12+07:00</updated>
    <author>
      <name>zendz</name>
    </author>
    <category term="*NIX" />
    <category term="IT" />
    <category term="Linux" />
    <category term="Security" />
    <category term="Software" />
    <category term="Thai" />
    <category term="Tips and Tricks" />
    <summary type="html"><![CDATA[  <p>พอดีลองวนๆ ไปหาอะไรอ่านเกี่ยวกับ project ที่ RH ดำเนินการอยู่พอดีไปเอะใจตรง SystemTab project ลองไปไล่ๆ อ่านดูทำไม concept เหมือน DTrace เลยหว่า</p>       <p>ลองอ่านๆ ในส่วนของ architecture ดูอืมม ไม่เหมือนแค่ concept ด้วยเห่ะ ทำงานยังคล้ายๆ กันเลย ใครสนใจลองไปดูได้ <a target="_blank" title="architecture paper (July 2005)" href="http://sourceware.org/systemtap/archpaper.pdf">architecture paper (July 2005)</a></p>    ]]></summary>
    <content type="html"><![CDATA[  <p>พอดีลองวนๆ ไปหาอะไรอ่านเกี่ยวกับ project ที่ RH ดำเนินการอยู่พอดีไปเอะใจตรง SystemTab project ลองไปไล่ๆ อ่านดูทำไม concept เหมือน DTrace เลยหว่า</p>       <p>ลองอ่านๆ ในส่วนของ architecture ดูอืมม ไม่เหมือนแค่ concept ด้วยเห่ะ ทำงานยังคล้ายๆ กันเลย ใครสนใจลองไปดูได้ <a target="_blank" title="architecture paper (July 2005)" href="http://sourceware.org/systemtap/archpaper.pdf">architecture paper (July 2005)</a></p>       <p>ส่วนในของ DTrace มันเป็นระบบ trace ที่ sun ทำออกมา support solaris ตั้งแต่ version 10 เป็นต้นมา ลองไปอ่านๆ ดูแล้วกัน แล้วจะบอกว่าคล้ายกันมาก</p>       <p>เอาคร่าวๆ แล้วกัน เอามาแปะให้ดู</p>       <blockquote>    <p><strong>DTrace</strong><br />    DTrace is a comprehensive dynamic tracing framework for the Solaris Operating Environment. DTrace provides a powerful infrastructure to permit administrators, developers, and service personnel to concisely answer arbitrary questions about the behavior of the operating system and user programs.</p>    </blockquote>       <blockquote>    <p><strong>SystemTap</strong><br />    The goal of SystemTap is to provide infrastructure to simplify the gathering of information about the running Linux kernel so that it can be further analyzed. This can assist in identifying the underlying cause of a performance or functional problem. SystemTap is designed to eliminate the need for the developer to go through the tedious instrument, recompile, install, and reboot sequence required to collect data on the operation of the kernel. The recent addition of Kprobes to the Linux kernel provides the needed support but does not provide an easy to use infrastructure. SystemTap provides a simple command line interface and scripting language for writing kernel instrumentation.&nbsp;</p>    </blockquote>       <p>แต่ละรายต่างก็บอกของตัวเองดี แต่ตอนนี้ทาง sun ค่อนข้างได้เปรียบมี scirpt ให้ Dtrace รวมทั้ง lib ให้ใช้ค่อนข้างเยอะ แต่ข้อเสียของมัน มีอยู่อย่างเดียว กิน resource เยอะฉิบเป๋งเลย แต่ในอนาคต ท่าทางฝั่ง RH น่าจะใช้งานง่ายกว่านะ แต่ไม่รู้สิ คงต้องรอดูต่อไป</p>       <p>ใครลอกใครหว่า เอาเถอะ ช่างมันมีอะไรมาให้ใช้มากขึ้นก็ดียิ่งๆ ขึ้น แต่ต้องมานั่งเขียน script อีกแล้วอ่ะดิ เฮ้อ</p>       <p>เพิ่มเติม<br />    ตัว Project frysk ก็ค่อนข้างน่าสนใจ แต่ทำไม มันจับแยกกันหว่า ดูรายละเอียดได้ที่ http://sourceware.org/frysk</p>       <p>&nbsp;</p>      ]]></content>
  </entry>
  <entry>
    <title>real world FIND usage</title>
    <link rel="alternate" type="text/html" href="http://www.howforge.com/real-world-find-usage" />
    <id>http://www.howforge.com/real-world-find-usage</id>
    <published>2006-02-27T10:30:20+07:00</published>
    <updated>2006-02-27T10:30:20+07:00</updated>
    <author>
      <name>zendz</name>
    </author>
    <category term="*NIX" />
    <category term="Linux" />
    <category term="Software" />
    <category term="Thai" />
    <category term="Tips and Tricks" />
    <summary type="html"><![CDATA[ <p>จำไม่เคยได้ซักทีเกี่ยวกับ find command แปะไว้กันลืมเจอมาจาก http://www.wagoneers.com/UNIX/FIND/find-usage.html</p> <pre>sudo find / -type f -name *.jpg  -exec cp {} . \;<br /> <br />find . -type f -size +10000 -exec ls -al {} \;<br />    ]]></summary>
    <content type="html"><![CDATA[ <p>จำไม่เคยได้ซักทีเกี่ยวกับ find command แปะไว้กันลืมเจอมาจาก http://www.wagoneers.com/UNIX/FIND/find-usage.html</p> <pre>sudo find / -type f -name *.jpg  -exec cp {} . \;<br /> <br />find . -type f -size +10000 -exec ls -al {} \;<br /><!--break-->find . -atime +1 -type f -exec mv {} TMP \; # mv files older then 1 day to dir TMP<br />find . -name &quot;-F&quot; -exec rm {} \;   # a script error created a file called -F <br />find . -exec grep -i &quot;vds admin&quot; {} \;<br />find . \! -name &quot;*.Z&quot; -exec compress -f {} \;<br />find . -type f \! -name &quot;*.Z&quot; \! -name &quot;.comment&quot; -print | tee -a /tmp/list<br />find . -name *.ini<br />find . -exec chmod 775 {} \;<br />find . -user xuser1 -exec chown -R user2 {} \;<br />find . -name ebtcom*<br />find . -name mkbook<br />find . -exec grep PW0 {} \;<br />find . -exec grep -i &quot;pw0&quot; {} \;<br />find . -atime +6<br />find . -atime +6 -exec ll | more<br />find . -atime +6 -exec ll | more \;<br />find . -atime +6 -exec ll \;<br />find . -atime +6 -exec ls \;<br />find . -atime +30 -exec ls \;<br />find . -atime +30 -exec ls \; | wc -l<br />find . -name auth*<br />find . -exec grep -i plotme10 {};<br />find . -exec grep -i plotme10 {} \;<br />find . -ls -exec grep 'PLOT_FORMAT 22' {} \;<br />find . -print -exec grep 'PLOT_FORMAT 22' {} \;<br />find . -print -exec grep 'PLOT_FORMAT' {} \;<br />find . -print -exec grep 'PLOT_FORMAT' {} \;<br />find ./machbook -exec chown 184 {} \;<br />find . \! -name '*.Z' -exec compress {} \;<br />find . \! -name &quot;*.Z&quot; -exec compress -f {} \;<br />find /raid/03c/ecn -xdev -type f -print<br />find /raid/03c/ecn -xdev -path -type f -print<br />find / -name .ssh* -print | tee -a ssh-stuff<br />find . -name &quot;*font*&quot;<br />find . -name hpmcad*<br />find . -name *fnt*<br />find . -name hp_mcad* -print<br />find . -grep Pld {} \;<br />find . -exec grep Pld {} \;<br />find . -exec grep Pld {} \;<br />find . -exec grep PENWIDTH {} \; | more<br />find . -name config.pro<br />find . -name config.pro<br />find /raid -type d &quot;.local_sd_customize&quot; -print<br />find /raid -type d -name &quot;.local_sd_customize&quot; -print<br />find /raid -type d -name &quot;.local_sd_customize&quot; -ok cp /raid/04d/MCAD-apps/I_Custom/SD_custom/site_sd_customize/user_filer_project_dirs {} \;<br />find /raid -type d -name &quot;.local_sd_customize&quot; -exec cp /raid/04d/MCAD-apps/I_Custom/SD_custom/site_sd_customize/user_filer_project_dirs {} \;<br />find . -name xeroxrelease<br />find . -exec grep xeroxrelease {} \;<br />find . -name xeroxrelease<br />find . -name xeroxrelease* -print 2&gt;/dev/null<br />find . -name &quot;*release*&quot; 2&gt;/dev/null<br />find / -name &quot;*xerox*&quot; 2&gt;/dev/null<br />find . -exec grep -i xeroxrelease {} \;<br />find . -print -exec grep -i xeroxrelease {} \;<br />find . -print -exec grep -i xeroxrelease {} \; &gt; xeroxrel.lis<br />find . -exec grep -i xeroxrel {} \;<br />find . -print -exec grep -i xeroxrel {} \;<br />find . -print -exec grep -i xeroxrel {} \; | more<br />find /raid/03c/inwork -xdev -type f -print &gt;&gt; /raid/04d/user_scripts/prt_list.tmp<br />find . -exec grep '31.53' {} \;<br />find . -ls -exec grep &quot;31/.53&quot; {} \; &gt; this.lis<br />find . -print -exec grep &quot;31/.53&quot; {} \; &gt; this.lis<br />find . -print -exec grep 31.53 {} \; &gt; this.lis<br />find . -exec grep -i pen {} /;<br />find . -exec grep -i pen {} \;<br />find . -print -exec grep -i pen {} \; | more<br />find . -exec grep -i pen {} \;<br />find . -atime +6 -exec ll | more \;<br />find . -atime +6 -exec ll \;<br />find . -atime +6 -exec ls \;<br />find . -atime +30 -exec ls \;<br />find . -atime +30 -exec ls \; | wc -l<br />find . \! -name '*.Z' -exec compress -f {} \;<br />find . -name 'cache*' -depth -exec rm {} \;<br />find . -name 'cache*' -depth -print | tee -a /tmp/cachefiles<br />find . -name 'cache[0-9][0-9]*' -depth -print | tee -a /tmp/cachefiles<br />find . -name 'hp_catfile' 'hp_catlock' -depth -print | tee -a /tmp/hp.cats<br />find . -name 'hp_catfile' -name 'hp_catlock' -depth -print | tee -a /tmp/hp.cats<br />find . -name 'hp_cat*' -depth -print | tee -a /tmp/hp.cats<br />find . -name 'hp_cat[fl]*' -depth -print | tee -a /tmp/hp.cats<br />find /raid -name 'hp_cat[fl]*' -depth -print<br />find . \! -name '*.Z' -exec compress -f {} \;<br />find . -name '*' -exec compress -f {} \;<br />find . -xdev -name &quot;wshp1*&quot; -print<br />find . -xdev -name &quot;wagoneer*&quot; -print<br />find . -name &quot;xcmd&quot; -depth -print<br />find /usr/contrib/src -name &quot;xcmd&quot; -depth -print<br />find /raid -type d -name &quot;.local_sd_customize&quot; -exec ls {} \; <br />find /raid -type d -name &quot;.local_sd_customize&quot;    -exec cp /raid/04d/MCAD-apps/I_Custom/SD_custom/site_sd_customize/user_filer_project_dirs {} \;</pre> <p>แปะไว้กันลืม <img border="0" alt="Tongue out" src="modules/tinymce/tinymce/jscripts/tiny_mce/plugins/emotions/images/smiley-tongue-out.gif" /></p>     ]]></content>
  </entry>
  <entry>
    <title>จะทำยังไงหาก swap partition เราไม่พอใช้งาน</title>
    <link rel="alternate" type="text/html" href="http://www.howforge.com/swap-partition" />
    <id>http://www.howforge.com/swap-partition</id>
    <published>2005-12-22T12:11:22+07:00</published>
    <updated>2006-03-15T09:33:51+07:00</updated>
    <author>
      <name>zendz</name>
    </author>
    <category term="*NIX" />
    <category term="Linux" />
    <category term="Thai" />
    <category term="Tips and Tricks" />
    <summary type="html"><![CDATA[ <p>อันนี้เป็น ของเก่าทำเก็บไว้กันลืม</p> <p>โดยปกติแล้ว เวลาเราลง OS มักจะได้รับคำแนะนำอยู่เสมอๆ ว่าควรจะ create swap partition ให้เป็นสองเท่าของเนื้อที่ Ram ของตัวเครื่อง ซึ่งบางครั้งมันก็ไม่ได้จำเป็นเสมอไป ยกตัวอย่างง่ายๆ หากเรามีเครื่องที่มี ram ซัก 2 GB ขึ้นไป หากทำตามคำแนะนำมันจะต้องเสียพื้นที่ 4GB ให้เป็น swap partition ซึ่งดูๆ ไปแล้วมันต้องบ้าแน่ๆ หากทำแบบนั้นกับ server ที่ไม่ได้ใช้ ram ขนาดนั้น โดยปกติ ผมเองจะทำอย่างมากก็ create swap partition แค่ 1GB นี่ก็โครตเยอะแล้ว</p>    ]]></summary>
    <content type="html"><![CDATA[ <p>อันนี้เป็น ของเก่าทำเก็บไว้กันลืม</p> <p>โดยปกติแล้ว เวลาเราลง OS มักจะได้รับคำแนะนำอยู่เสมอๆ ว่าควรจะ create swap partition ให้เป็นสองเท่าของเนื้อที่ Ram ของตัวเครื่อง ซึ่งบางครั้งมันก็ไม่ได้จำเป็นเสมอไป ยกตัวอย่างง่ายๆ หากเรามีเครื่องที่มี ram ซัก 2 GB ขึ้นไป หากทำตามคำแนะนำมันจะต้องเสียพื้นที่ 4GB ให้เป็น swap partition ซึ่งดูๆ ไปแล้วมันต้องบ้าแน่ๆ หากทำแบบนั้นกับ server ที่ไม่ได้ใช้ ram ขนาดนั้น โดยปกติ ผมเองจะทำอย่างมากก็ create swap partition แค่ 1GB นี่ก็โครตเยอะแล้ว</p> <p>แต่หลังจากนั้น ผมก็พบประสบการณ์อันน่ากลัว ที่ไม่เคยคาดคิดเกิดขึ้น คือ ram ไม่พอ แล้วมันไป swap จน swap จะหมด จนคิดว่าจะทำอย่างไรดี</p> <p>สุดท้ายก็นึกว่าได้ มันทำ swap file ได้นี่หว่า (วิธีนี้อาจจะมีข้อเสีย ซึ่งจากที่ไปอ่านๆ ตามต่างประเทศเค้าบอกกันว่า มันจะทำให้ช้ากว่าแยกเป็น parition แต่ผมคิดว่าถ้ามันไม่บ่อยก็คงไม่มีปัญหาอะไร)</p> <p><strong><u>วิธีทำ</u></strong><br /> </p> <ol> <li>ทำการสร้าง file จากความว่างเปล่า โดยในที่นี้ผมจะสร้างให้มันมีขนาดซัก 512MB เอามันไว้ที่ไหนก็ได้ที่มีที่เหลือให้มันอยู่ นั้นล่ะ ในกรณีนี้สมมุติว่า root มันว่างแล้วกัน ง่ายดี <br /> <pre># dd if=/dev/zero of=/swapfile1 bs=1024 count=524288000</pre>   </li> <li>ขั้นต่อมาสั่งให้มันกลายเป็น swap file ซะ<div id="console"> <pre># mkswap /swapfile1</pre></div></li> <li>จากนั้น สั่งให้มันสามารถนำมาใช้งานได้โดยสั่ง  <pre># swapon /swapfile1</pre>สามารถลองตรวจสอบได้จาก คำสั่ง cat /proc/swap</li> <br /> <li>ในกรณีที่เราต้องการให้มันกลายเป็น default ไปเลยนั้นให้แก้ไขที่ <em>/etc/fstab</em> แล้วก็เติมข้อความดังข้างล่างนี้ลงไปท้ายสุด<br /> <pre>/swapfile1   swap   swap    defaults 0 0</pre></li> </ol> <p>&nbsp;</p>     ]]></content>
  </entry>
  <entry>
    <title>log rotation บน solaris</title>
    <link rel="alternate" type="text/html" href="http://www.howforge.com/log-rotation-solaris" />
    <id>http://www.howforge.com/log-rotation-solaris</id>
    <published>2005-12-14T15:26:29+07:00</published>
    <updated>2006-03-15T09:49:08+07:00</updated>
    <author>
      <name>zendz</name>
    </author>
    <category term="*NIX" />
    <category term="Thai" />
    <category term="Tips and Tricks" />
    <summary type="html"><![CDATA[<p>เดี๋ยวนี้มีอะไรเกี่ยวกับ solaris มากเหลือเกิน วุ่นวายดี อันนี้จะเป้นเรื่องย้อนหลังหน่อย เกี่ยวกับ log rotation บน solaris นั้นล่ะ คือที่ผ่านมาได้จับงานอยู่งานหนึ่งเขียน application จากนั้นจะต้องทำ log rotation บน solaris ซึงมันเป็นเครื่องของคนอื่น แถมไ่ม่ได้ลง logrotate บนนั้นอีก <em>(ทำไม ที่นั้นไม่ใช้ logrotate หว่า ไม่เข้าใจ)</em> เลยต้องมาเขียนเอง</p>    ]]></summary>
    <content type="html"><![CDATA[<p>เดี๋ยวนี้มีอะไรเกี่ยวกับ solaris มากเหลือเกิน วุ่นวายดี อันนี้จะเป้นเรื่องย้อนหลังหน่อย เกี่ยวกับ log rotation บน solaris นั้นล่ะ คือที่ผ่านมาได้จับงานอยู่งานหนึ่งเขียน application จากนั้นจะต้องทำ log rotation บน solaris ซึงมันเป็นเครื่องของคนอื่น แถมไ่ม่ได้ลง logrotate บนนั้นอีก <em>(ทำไม ที่นั้นไม่ใช้ logrotate หว่า ไม่เข้าใจ)</em> เลยต้องมาเขียนเอง</p><p>ขอเอา script มาแปะไว้กันหาย กันลืม และเผื่อคนอื่นๆ <br /></p><pre>#!/usr/bin/bash<br />archiveName=blabla<br />archiveBack=7<br />archivePath=/some/archive/log/path<br /><br />logPath1=/where/path/log/for/archive/1<br />logPath2=/where/path/log/for/archive/2<br /><br />#archiveDate=`date '+%Y-%m-%d'`<br />archiveDate=`getbefortoday`<br /><br /><br /># ---- begin make archive ----<br />archiveNo=0<br />n=$archiveBack<br /><br />echo &quot;starting archiving log file of $archiveDate ...&quot;<br /><br />cd $archivePath<br /><br />for ((i = 0; i &lt;= $archiveBack; i++)); do<br />  if [ -w $archiveName.$n.tar.bz2 ] ; then<br />    m=$(($n + 1))<br />    mv -f $archiveName.$n.tar.bz2 $archiveName.$m.tar.bz2 <br />  fi <br />  n=$(($n - 1))<br />done<br /><br /># tar and compress log files<br />cd $archivePath<br />tar -cf $archiveName.0.tar $logPath1/$archiveDate.* $logPath2/$archiveDate.*<br />bzip2 -9f $archiveName.0.tar<br />echo &quot;finish archive.&quot; ; echo &quot; &quot;<br /><br /><br />echo &quot;starting delete old log files...&quot;<br />rm -rf $logPath1/$archiveDate.* $logPath2/$archiveDate.*<br />echo &quot;finish delete old log files&quot; ; echo &quot; &quot;<br /><br /><br /># delete old archive log file<br />echo &quot;starting delete old archive log files.&quot;<br />rm -f $archivePath/$archiveName.$((archiveBack + 1)).tar.bz2</pre><p>จาก scirpt ดังกล่าวจะมีบรรทัดหนึ่ง คือ archiveDate=`getbefortoday` ตรงนี้จะไปเรียก java app เล็กๆ ที่หาวันย้อนหลังของเครื่องไป 1 วัน โดยมี format yyyy-mm-dd ซึ่งโดยปกติบน linux ผมจะใช้คำสั่ง date แล้วใส่ format เอา แต่บน solaris มันสั่งไม่เหมือนกัน แถมรีบๆ เขียน java app มันซะเลย</p><p>ปล. scipt ผมปัญญาอ่อนนิดหน่อยนะ หากใครคิดว่ามีทางไหนทำได้ดีกว่านี้ลองแนะนำหน่อย</p><p>&nbsp;</p>    ]]></content>
  </entry>
  <entry>
    <title>mysql กับภาษาไทย อีกรอบ</title>
    <link rel="alternate" type="text/html" href="http://www.howforge.com/mysql" />
    <id>http://www.howforge.com/mysql</id>
    <published>2005-12-14T08:36:45+07:00</published>
    <updated>2005-12-14T08:36:45+07:00</updated>
    <author>
      <name>zendz</name>
    </author>
    <category term="IT" />
    <category term="Thai" />
    <category term="Tips and Tricks" />
    <summary type="html"><![CDATA[<p>เนื่องจากครั้งก่อนได้มีการแก้ mysql ให้ใช้ไทยได้ พบว่ามันไม่ค่อยสะดวก เลยหาวิธีใหม่ซึ่งง่ายกว่านั้น สั่ง server ให้ default charset เป็น tis620 ซะเลยง่ายดี</p>   <p>วิธีการแก้ไขก็ง่ายๆ คือ แก้ file /SomePath/my.cnf โดยเพิ่มเติมดังนี้&nbsp;</p>   <pre><strong>[mysqld]</strong><br />port=3307<br />datadir=/var/lib/mysql<br />socket=/var/lib/mysql/mysql.sock<br /><font color="#ff0000">default-character-set=tis620</font><br /># Default to using old password format for compatibility with mysql 3.x<br /># clients (those using the mysqlclient10 compatibility package).<br />old_passwords=1<br />  <br /><strong>[mysql.server]</strong><br />user=mysql<br />basedir=/var/lib<br /><font color="#ff0000">default-character-set=tis620</font><br />  <br /><strong>[mysqld_safe]</strong><br />err-log=/var/log/mysqld.log<br />pid-file=/var/run/mysqld/mysqld.pid<br /><font color="#ff0000">default-character-set=tis620</font><br />  <br /><font color="#ff0000"><strong>[mysql]</strong><br />default-character-set=tis620</font><br />  </pre>  <p>ในส่วนของสีแดงคือที่เพิ่มเข้าไป จากนั้น restart service ก็ใช้ได้ตามปกติ ในที่นี้ทดลองกับ mysql version 4.1.x และ 5.0.x พบว่าใช้งานได้ดี และเหตุผลที่เพิ่ม [mysql] เข้าไปเนื่องจากเวลาใช้งาน mysql shell จะได้มี default charset เป็น tis620 ด้วย เผื่อทำการ import sql</p>    ]]></summary>
    <content type="html"><![CDATA[<p>เนื่องจากครั้งก่อนได้มีการแก้ mysql ให้ใช้ไทยได้ พบว่ามันไม่ค่อยสะดวก เลยหาวิธีใหม่ซึ่งง่ายกว่านั้น สั่ง server ให้ default charset เป็น tis620 ซะเลยง่ายดี</p>   <p>วิธีการแก้ไขก็ง่ายๆ คือ แก้ file /SomePath/my.cnf โดยเพิ่มเติมดังนี้&nbsp;</p>   <pre><strong>[mysqld]</strong><br />port=3307<br />datadir=/var/lib/mysql<br />socket=/var/lib/mysql/mysql.sock<br /><font color="#ff0000">default-character-set=tis620</font><br /># Default to using old password format for compatibility with mysql 3.x<br /># clients (those using the mysqlclient10 compatibility package).<br />old_passwords=1<br />  <br /><strong>[mysql.server]</strong><br />user=mysql<br />basedir=/var/lib<br /><font color="#ff0000">default-character-set=tis620</font><br />  <br /><strong>[mysqld_safe]</strong><br />err-log=/var/log/mysqld.log<br />pid-file=/var/run/mysqld/mysqld.pid<br /><font color="#ff0000">default-character-set=tis620</font><br />  <br /><font color="#ff0000"><strong>[mysql]</strong><br />default-character-set=tis620</font><br />  </pre>  <p>ในส่วนของสีแดงคือที่เพิ่มเข้าไป จากนั้น restart service ก็ใช้ได้ตามปกติ ในที่นี้ทดลองกับ mysql version 4.1.x และ 5.0.x พบว่าใช้งานได้ดี และเหตุผลที่เพิ่ม [mysql] เข้าไปเนื่องจากเวลาใช้งาน mysql shell จะได้มี default charset เป็น tis620 ด้วย เผื่อทำการ import sql</p>   <p>และในส่วนของ phpMyAdmin ที่เคยใช้แล้วมีปัญหา ได้ทดลองเอา version phpMyAdmin-2.7.0-pl1 มาใช้งาน และเลือก connection collation เป็น tis620_thai_ci พบว่าใช้งานได้ดีเหมือนกัน&nbsp;</p>    ]]></content>
  </entry>
  <entry>
    <title>startup scritp vsftpd on solaris9</title>
    <link rel="alternate" type="text/html" href="http://www.howforge.com/startup-scritp-vsftpd-on-solaris9" />
    <id>http://www.howforge.com/startup-scritp-vsftpd-on-solaris9</id>
    <published>2005-12-13T16:09:29+07:00</published>
    <updated>2005-12-13T16:09:29+07:00</updated>
    <author>
      <name>zendz</name>
    </author>
    <category term="*NIX" />
    <category term="IT" />
    <category term="Thai" />
    <category term="Tips and Tricks" />
    <summary type="html"><![CDATA[<p>จากที่ผ่านมาได้มีการลง vsftpd server บน solaris9 พบว่ามีปัญหาเกิดขึ้นเมื่อ user ทำการ reboot เครื่องแล้ว service vsftpd ไม่ได้ start (ที่มันไม่ start เพราะไม่ได้ใส่ไว้อ่ะดิ)</p><p>เลยมาทำการแก้ปัญหาให้ user โดยจัดการให้ ตอนแรกว่าจะใส่ใน rc.local ง่ายดี พบว่ามันไม่มีนี่หว่า สุดท้ายพบว่าต้องมาเขียนเองซะแล้ว ใครมีหนทางที่ดีกว่านี้เสนอมาหน่อยเถอะ เกิดมี service ที่ต้องใส่เข้าไปอีก มาเขียนตลอดคงไม่ไหว<br /><br />ขั้นแรกเขียน rc script ขึ้นมาซะ โดยมีรายละเอียดดังนี้ (เอา mysql script บางส่วนมาเป็นแนวทาง) </p>    ]]></summary>
    <content type="html"><![CDATA[<p>จากที่ผ่านมาได้มีการลง vsftpd server บน solaris9 พบว่ามีปัญหาเกิดขึ้นเมื่อ user ทำการ reboot เครื่องแล้ว service vsftpd ไม่ได้ start (ที่มันไม่ start เพราะไม่ได้ใส่ไว้อ่ะดิ)</p><p>เลยมาทำการแก้ปัญหาให้ user โดยจัดการให้ ตอนแรกว่าจะใส่ใน rc.local ง่ายดี พบว่ามันไม่มีนี่หว่า สุดท้ายพบว่าต้องมาเขียนเองซะแล้ว ใครมีหนทางที่ดีกว่านี้เสนอมาหน่อยเถอะ เกิดมี service ที่ต้องใส่เข้าไปอีก มาเขียนตลอดคงไม่ไหว<br /><br />ขั้นแรกเขียน rc script ขึ้นมาซะ โดยมีรายละเอียดดังนี้ (เอา mysql script บางส่วนมาเป็นแนวทาง) </p><pre>#!/bin/bash<br /># Copyright Sudkhet C. 2005<br /># This file is public domain and comes with NO WARRANTY of any kind<br /><br /># vsftpd daemon start/stop script.<br /><br /># Usually this is put in /etc/init.d (at least on machines SYSV R4 based<br /># systems) and linked to /etc/rc3.d/S51vsftpd and /etc/rc0.d/K07vsftpsd.<br /># When this is done the vsftpd server will be started when the machine is<br /># started and shut down when the systems goes down.<br />exec_daemon=/usr/sbin/vsftpd<br />conf_daemon=/etc/vsftpd/vsftpd.conf<br />pid_file=/var/run/vsftpd.pid<br /><br />case &quot;$1&quot; in<br /><br />start)<br />  # Start daemon.<br />  $exec_daemon $conf_daemon &amp;<br />  pid=$!<br />  echo $pid &gt; $pid_file<br />  echo &quot;Start vsftpd Done!.&quot;<br />  ;;<br /><br />stop)<br />    # Stop daemon. We use a signal here to avoid having to know the<br />    if test -s &quot;$pid_file&quot;<br />  then<br />    vsftpd_pid=`cat $pid_file`<br />    echo &quot;Killing vsftpd with pid $vsftpd_pid&quot;<br />    kill $vsftpd_pid<br />    # vsftpd should remove the pid_file when it exits, so wait for it.<br /><br />    sleep 1<br />    while [ -s $pid_file -a &quot;$flags&quot; != aaaaaaaaaaaaaa ]<br />    do<br />      [ -z &quot;$flags&quot; ] &amp;&amp;amp; echo $echo_n &quot;Wait for vsftpd to exit$echo_c&quot; || echo $echo_n &quot;.$echo_c&quot;<br />      flags=a$flags<br />      sleep 1<br />    done<br /><br />    if [ -s $pid_file ]<br />       then echo &quot; gave up waiting!&quot;<br />    elif [ -n &quot;$flags&quot; ]<br />       then echo &quot; done&quot;<br />    fi<br />    # delete lock for RedHat / SuSE<br />    if test -f $pid_file<br />    then<br />      rm -f $pid_file<br />    fi<br />  else<br />    echo &quot;No vsftpd pid file found. Looked for $pid_file.&quot;<br />  fi<br />  ;;<br /><br />*)<br />  # usage<br />  echo &quot;Usage: $0 start|stop|restart&quot;<br />  exit 1<br />  ;;<br />esac</pre><ol><li>จากนั้นก็ save ในชื่อ vsftpd แล้วเอาไปไว้ที่ /etc/init.d/vsftpd</li><li>ทำการ change mode และ permission โดยสั่งดังนี้ <div id="console"><pre># chmod 744 vsftpd<br /># chown root:sys vsftpd<br /></pre></div></li><li>จากนั้นให้เพิ่มในส่วนของ startup และ shutdown ที่อยู่ใน rc โดยทำดังนี้<br /><pre># cp vsftpd /etc/rc3.d/S51vsftpd<br /># cp vsftpd /etc/rc0.d/K17vsftpd<br /># chown root:sys /etc/rc3.d/S51vsftpd<br /># chown root:sys /etc/rc0.d/K17vsftpd</pre> </li><li>จากนั้นลอง reboot เครื่องทดสอบพบว่าใช้การได้ดี<br /></li></ol><p>มีข้อเสนอแนะตรงไหน กรุณาบอกกล่าวด้วย <img border="0" alt="Smile" src="modules/tinymce/tinymce/jscripts/tiny_mce/plugins/emotions/images/smiley-smile.gif" /></p><p>&nbsp;</p>    ]]></content>
  </entry>
  <entry>
    <title>ปัญหาของภาษาไทยกับ MySQL 5</title>
    <link rel="alternate" type="text/html" href="http://www.howforge.com/mysql-5" />
    <id>http://www.howforge.com/mysql-5</id>
    <published>2005-11-26T08:57:04+07:00</published>
    <updated>2006-04-12T16:47:36+07:00</updated>
    <author>
      <name>zendz</name>
    </author>
    <category term="IT" />
    <category term="Software" />
    <category term="Thai" />
    <category term="Tips and Tricks" />
    <summary type="html"><![CDATA[<p>จากปกติ MySQL version เก่าใช้งานกับภาษาไทยมันจะไม่มีปัญหาอะไรเพราะมีการเก็บ data ที่เป็น ANSI code แต่มา version ใหม่ๆ ได้มีการปรับเปลี่ยนการเก็บ data ที่เปลี่ยนแปลงจากเดิมโดยมีการเก้บเป็น unicode ซึ่งโดยส่วนใหญ่ developer ของเมืองไทย ยังไม่ทราบและมีปัญหาบ่อยๆ กับตรงนี้</p>    ]]></summary>
    <content type="html"><![CDATA[<p>จากปกติ MySQL version เก่าใช้งานกับภาษาไทยมันจะไม่มีปัญหาอะไรเพราะมีการเก็บ data ที่เป็น ANSI code แต่มา version ใหม่ๆ ได้มีการปรับเปลี่ยนการเก็บ data ที่เปลี่ยนแปลงจากเดิมโดยมีการเก้บเป็น unicode ซึ่งโดยส่วนใหญ่ developer ของเมืองไทย ยังไม่ทราบและมีปัญหาบ่อยๆ กับตรงนี้</p><p>จริงๆ มีวิธีแก้ค่อนข้างหลายวิธีเหมือนกันหากไม่สามารถกระทำการใดๆ ต่อตัว server เนื่องจากเราไปเช่าเค้าหรืออะไรก็ตามที่ เราต้องมาแก้ที่ application ของเราเองโดยทำการเพิ่มขั้นตอนในการทำงานเข้าไปซักหน่อย โดยทำดังนี้</p><p>ทุกครั้งก่อนที่จะทำการ create connection ให้สั่งดังนี้&nbsp; <em>ตัวอย่างเป็น PHP นะ</em></p>
<?php
$sql = 'SET CHARACTER SET tis620';
mysql_query($sql);
$sql ="SET collation_connection = 'tis620_thai_ci' ";
mysql_query($sql);
?>
<p>ก็ประมาณคร่าวๆ นี่ล่ะ</p><p>ปล. ไม่ได้ Update blog ซะนานปัญหาส่วนตัวเยอะเหมือนเดิม เฮ้อ จะพยายาม update บ่อยเท่าที่ทำได้แล้วกัน&nbsp;</p>    ]]></content>
  </entry>
  <entry>
    <title>vsftpd บน Solaris9</title>
    <link rel="alternate" type="text/html" href="http://www.howforge.com/vsftpd-solaris9" />
    <id>http://www.howforge.com/vsftpd-solaris9</id>
    <published>2005-11-03T11:37:30+07:00</published>
    <updated>2005-11-03T11:37:30+07:00</updated>
    <author>
      <name>zendz</name>
    </author>
    <category term="*NIX" />
    <category term="IT" />
    <category term="Thai" />
    <category term="Tips and Tricks" />
    <summary type="html"><![CDATA[ <p>พอดีได้ไปแก้ระบบของกระทรวงแห่งหนึ่ง ซึ่งได้รับ request จากลูกค้ามาว่าต้องการให้ user ที่ login ใน service ftp ให้เห้นแต่เฉพาะ home ของตัวเองเท่านั้น ซึ่งจากที่เคยทำมา ftp service ของ solaris มันทำไม่ได้มั๊ง เพราะยังไม่เคยเห็น doc เลย เลยหันมาเลือกใช้ของที่คุ้นมือดีกว่า ซึ่งก็คือ vsftpd</p>    ]]></summary>
    <content type="html"><![CDATA[ <p>พอดีได้ไปแก้ระบบของกระทรวงแห่งหนึ่ง ซึ่งได้รับ request จากลูกค้ามาว่าต้องการให้ user ที่ login ใน service ftp ให้เห้นแต่เฉพาะ home ของตัวเองเท่านั้น ซึ่งจากที่เคยทำมา ftp service ของ solaris มันทำไม่ได้มั๊ง เพราะยังไม่เคยเห็น doc เลย เลยหันมาเลือกใช้ของที่คุ้นมือดีกว่า ซึ่งก็คือ vsftpd</p> <p>ในตอนแรกด้วย ความขี้เกียจลงเลยจะหา binary แต่ดันไม่มีนี่ซิ เลยต้องมานั่ง compile ลงเอง แต่ไม่เป็นไรมาลองกันซักตั้ง เริ่มแรกไป download vsftpd จาก web มาก่อนเลย download ได้ที่นี่ http://vsftpd.beasts.org</p>  <ol>   <li>จากนั้นนำ file ที่เรา download  มาได้เอาไปไว้ที่ /usr/local/src ซะ ในที่นี่ใช้ version 2.0.3 แตกมันซะ <pre>$ gzip -dc vsftpd-2.0.3.tar.gz | tar xvf - </pre> </li> <li>หลังจากนั้นเข้าไปแก้ &quot;builddefs.h&quot; เพื่อกำหนดว่าเราจะเอา feature อะไรบ้างจากของเดิม #undef VSF_BUILD_SSL ผมแก้เป็น #define VSF_BUILD_SSL โดยจุดประสงค์<strong>เผื่อ</strong>จะใช้ ssl ในการ authen </li><li>จากนั้นก็สั่ง make ซะ พบ error บางอย่างเกี่ยวกับ ssl lib เลยแก้ปัญหาแบบทื่อๆ เมื่อลงแล้วหาไม่เจอ ทำ link ให้ซะเลย เนื่องจากมันหา lib ssl ไม่เจอ ซึ่งผมลง openssl ไว้ที่ /usr/local/ssl โดยสั่งแบบนี้ <pre># cd /lib<br /># ln -s /usr/local/ssl/lib/libcrypto.so /lib/libcrypto.so<br /># ln -s /usr/local/ssl/lib/libssl.so /lib/libssl.so<br /># ln -s /usr/local/openssl /usr/include/ssl</pre></li> <li>จากนั้นลอง make ใหม่ ก็เสร็จเรียบร้อย จากนั้นก็ make install โลด แล้วลอง run โดยสั่ง <pre># vsftpd /etc/vsftpd/vsftpd.conf &amp; <br /># ftp localhost<br /># vsftpd /etc/vsftpd/vsftpd.conf &amp;<br /># ftp localhost<br />Connected to localhost.<br />220 .<br />Name (localhost:xxxxx):<br />331 Please specify the password.<br />Password:<br />230 Login successful.<br />Remote system type is UNIX.<br />Using binary mode to transfer files.<br />ftp&gt; bye<br />221 Goodbye.</pre>เอาละเรียบร้อยดี ใช้งานได้ล่ะ ทีเหลือก็ config ตามใจชอบ   </li> </ol>     ]]></content>
  </entry>
  <entry>
    <title>Reset root password ของ MySQL</title>
    <link rel="alternate" type="text/html" href="http://www.howforge.com/reset-root-password-mysql" />
    <id>http://www.howforge.com/reset-root-password-mysql</id>
    <published>2005-08-30T09:17:56+07:00</published>
    <updated>2006-03-14T22:33:36+07:00</updated>
    <author>
      <name>zendz</name>
    </author>
    <category term="*NIX" />
    <category term="IT" />
    <category term="Linux" />
    <category term="Software" />
    <category term="Thai" />
    <category term="Tips and Tricks" />
    <summary type="html"><![CDATA[ <p>บางครั้งเครื่องที่ตัวเองดูแลมีเยอะมาก จนนานๆ ทีถึงจะเข้ามา manage ซักที และบางครั้งถึงกับให้ลืม password ตัวนั้นตัวนี้จนได้ และลืมมาก จนบางทีลืม password root ของ mysql ไปเลย <img border="0" alt="Yell" src="modules/tinymce/tinymce/jscripts/tiny_mce/plugins/emotions/images/smiley-yell.gif" /><br /> <br /> เรามาดูวิธี reset root password ของ mysql กัน ทำดังนี้  </p>    ]]></summary>
    <content type="html"><![CDATA[ <p>บางครั้งเครื่องที่ตัวเองดูแลมีเยอะมาก จนนานๆ ทีถึงจะเข้ามา manage ซักที และบางครั้งถึงกับให้ลืม password ตัวนั้นตัวนี้จนได้ และลืมมาก จนบางทีลืม password root ของ mysql ไปเลย <img border="0" alt="Yell" src="modules/tinymce/tinymce/jscripts/tiny_mce/plugins/emotions/images/smiley-yell.gif" /><br /> <br /> เรามาดูวิธี reset root password ของ mysql กัน ทำดังนี้  </p> <ol>    <li>เ พิ่ม &quot;skip-grant-tables&quot; ลงใน file my.cnf โดยปกติทั่วไปจะเก็บอยู่ที่ /etc/my.cnf โดยเพิ่มในส่วนของ [mysqld] สำคัญมากห้ามลืม อย่าใส่ผิดที่ ไม่ัอย่างนั้นจะไม่สามารถ reset password ได้  </li>      <li>สั่ง restart mysql service ซะ ในที่นี้ ผมใช้ RH base เป็นหลัก ใครใช้อย่างไหน ก็ restart อย่างนั้นล่ะ  <pre><span style="color: #33ff33; font-style: italic">ถ้าเป็น RH สั่งแบบนี้</span> <br /># /etc/init.d/mysqld restart <span style="color: #33ff33; font-style: italic"><br /><br />หรือแบบนี้</span> <br /># service mysql restart</pre></li>   <li>ตั้งค่า mysql root password ใหม่ซะ จะสั่งแบบไหนก็ได้ จะเข้า console หรือสั่งผ่าน command line ก็ตามสะดวก  </li>      <li>นำ skip-grant-tables ออกจาก file my.cnf ซะ  </li>     <li>restart mysql service เป็นอันเสร็จ</li>  </ol>  จากนั้นให้ลองเข้า mysql ดู ลองสั่งดังนี้<br /><pre>mysql -uroot -p<br />Enter password: &lt;&lt;&lt;&lt; ใส่ pass ที่เพิ่ง reset ซะ<br />Welcome to the MySQL monitor.  Commands end with ; or \g.<br />Your MySQL connection id is 151906 to server version: 4.1.10a<br /><br />Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br /><br />mysql&gt; </pre>    ถ้าเข้าได้แบบด้านบน แสดงว่าเรียบร้อย  .    ]]></content>
  </entry>
  <entry>
    <title>web จะ design ให้ง่ายต้อง css ซิ</title>
    <link rel="alternate" type="text/html" href="http://www.howforge.com/web-design-css" />
    <id>http://www.howforge.com/web-design-css</id>
    <published>2005-08-24T11:04:27+07:00</published>
    <updated>2005-08-24T11:04:27+07:00</updated>
    <author>
      <name>zendz</name>
    </author>
    <category term="General" />
    <category term="Thai" />
    <summary type="html"><![CDATA[<p>แปลกใจ web ในเมืองไทยไม่ค่อยเห็นใช้ css กันมากมายเท่าไรเหมือนเมืองนอกเล่นประเดประดัง graphic ลงไปอย่างเดียว เวลามีการแก้ไขข้อมูลคราวนี้ก็จุกเลยรื้อทำใหม่</p><p>หากจะให้ง่ายมาใช้ css ซิ ผมว่าง่ายต่อการจัด style ของ website ด้วย เพียงแค่เปลี่ยน css อารมณ์และ theme ของ web ก็เปลี่ยนแล้วไม่เชื่อลองดู web นี้ซิ <a href="http://www.csszengarden.com/">css Zen Garden</a></p>    ]]></summary>
    <content type="html"><![CDATA[<p>แปลกใจ web ในเมืองไทยไม่ค่อยเห็นใช้ css กันมากมายเท่าไรเหมือนเมืองนอกเล่นประเดประดัง graphic ลงไปอย่างเดียว เวลามีการแก้ไขข้อมูลคราวนี้ก็จุกเลยรื้อทำใหม่</p><p>หากจะให้ง่ายมาใช้ css ซิ ผมว่าง่ายต่อการจัด style ของ website ด้วย เพียงแค่เปลี่ยน css อารมณ์และ theme ของ web ก็เปลี่ยนแล้วไม่เชื่อลองดู web นี้ซิ <a href="http://www.csszengarden.com/">css Zen Garden</a></p><p>ง่ายๆ ลองใส่ตามนี้ แล้วลองสังเกต content ที่อยู่ดู content เดียวกันเปลี่ยนแต่เพียง css</p><p>http://www.csszengarden.com/?cssfile=/<span style="font-weight: bold; color: red">xxx</span>/<span style="font-weight: bold; color: red">xxx</span>.css&amp;page=0 </p><p>เปลี่ยนตรง xxx เป็นเลขที่ต้องการ เช่น 123, 023 หรืออื่นๆ ทำเป็น Link ให้กดง่ายๆ แล้วกัน เอาที่สวยๆ หน่อย</p><ul><li><a href="http://www.csszengarden.com/?cssfile=/177/177.css">Sample1</a></li><li><a href="http://www.csszengarden.com/?cssfile=/178/178.css">Sample2</a></li><li><a href="http://www.csszengarden.com/?cssfile=http://www.praxisstudios.com/zen_webula/zengarden-base.css">Sample3</a></li></ul>    ]]></content>
  </entry>
</feed>

