Curu Wong

Author's details

Date registered: April 16, 2010

Latest posts

  1. Setup Linux as wifi hotspot with NetworkManager — February 19, 2012
  2. why squid listen on high udp port number — February 17, 2012
  3. Linux系统编程知识在运维排错中的应用 — December 26, 2011
  4. Bash quote trap: why rsync exclude pattern not work — October 27, 2011
  5. Using libcurl: follow redirect and get header only — October 2, 2011

Most commented posts

  1. check_mailstat.pl: a nagios plugin for monitoring mail server statistics — 9 comments
  2. 如何在Joomla Content Editor内添加MSN链接 — 3 comments
  3. rhel6 disabled iptables on bridge interface by default — 3 comments
  4. Upload local mails to IMAP server using Thunderbird — 2 comments
  5. Monitoring email server with Cacti — 2 comments

Author's posts listings

Feb 19

Setup Linux as wifi hotspot with NetworkManager

First of all, note that if your wireless card does not support master/hostap mode, you can only use ad-hoc mode, which allows only one device to connect. Secondly, NetworkManager only support WEP for ad-hoc mode, so don’t select other Security method like WPA. If you don’t want to ask for trouble, select “WEP 40/128-bit Key”. …

Continue reading »

Feb 17

why squid listen on high udp port number

When starting squid with the default configuration (compiled from source), you may notice that the squid process listens not only on TCP port 3128, but also a high UDP port. netstat -tlunp | grep squid tcp 0 0 :::3128 :::* LISTEN 3520/(squid) udp 0 0 0.0.0.0:52431 0.0.0.0:* 3520/(squid) udp 0 0 :::51621 :::* 3520/(squid) What …

Continue reading »

Dec 26

Linux系统编程知识在运维排错中的应用

1.    谁偷了我的磁盘空间? 发现大小为10G的/home分区磁盘空间使用了9.8G,但是通过du得到的大小却是5G. 另外的4.8G空间哪里去了呢? df -Th /home Filesystem    Type    Size  Used Avail Use% Mounted on /dev/sda3      ext3     10G   9.8G  0.2G  98% /home du -hs /home 5.0G    /home/ du和df都不太可能出错,文件系统也没有损坏的迹象,那问题出在哪儿呢?查看unlink系统调用的手册页:

Oct 27

Bash quote trap: why rsync exclude pattern not work

rsync exlude pattern works when use the eval command

A friend wanted to sync all his files to a remote host, exluding the source files(those with suffix .c, .cpp, .h, .hpp). First I wrote this script #!/bin/bash ####sync.sh (version 1): sync files to remote host### SYNC_DST=’xxx@example.com::sample_project’ SYNC_OPT=’ –exclude=”*.[ch]” –exclude=”*.[ch]pp” ‘ if [[ $# -eq 0 ]]; then echo “Usage $0 /src/path” exit 1 fi …

Continue reading »

Oct 02

Using libcurl: follow redirect and get header only

Let’s look at a sample code first(I use the WWW::Curl perl module here, the idea is the same for other language). #!/usr/bin/perl use warnings; use strict; use WWW::Curl::Easy; my $url = ‘http://search.cpan.org/CPAN/authors/id/L/LO/LORN/LWP-Curl-0.09.tar.gz’; my $resp_body; #Get file length via HTTP HEAD request my $length; my $curl = WWW::Curl::Easy->new(); $curl->setopt(CURLOPT_URL, $url); #follow redirect $curl->setopt(CURLOPT_FOLLOWLOCATION, 1); #inlcude header …

Continue reading »

Aug 19

add utf8 subject support to mailwatch 1.0.5

In mailwatch v1.0.5, if the subject of a message is utf8 encoded, it can’t display correctly on the message list page. All the non-ascii characters will be replaced with question mark. For example. the subject “我爱Linux” will appears as “??Linux”. We can patch mailwatch to support this: 1. patch Mailwatch.pm — MailWatch.pm.bak 2011-08-19 14:15:45.565769650 +0800 …

Continue reading »

Aug 02

Apache options directive trap

When configuring the Apache HTTP server, we use the Options directive to control which server features are available in a particular directory. We may, for example, write a config like this: <Directory /usr/share/nagios> Options +ExecCGI Indexes FollowSymLinks … </Directory> With this configuration, we hope to enable CGI if it has not been enabled, and set …

Continue reading »

Jul 29

Build the Linux kernel for other host

Building the linux kernel is time and resource consuming, especially when you do this in a VM guest. fortunately, We can choose a fast Linux machine to take the burden of building, then install the kernel to the target Linux host This simple article assumes that you know how to config and compile your custom …

Continue reading »

Jul 20

Install from source or use rpm, this is a question

Install software packages from prebuilt rpm is not always simple and good. If we need more configure option and consistent behavior, build from source

Jul 08

Shorewall: allow communication between VPN clients

If you setup Linux as a PPTP or L2TP/IPSec VPN server, every client connection will have a corresponding pppx interface on the server. You may have a shorewall interface config like this: /etc/shorewall/interfaces #zone interface boradcast options l2tp ppp+ – Assume that client A connected, get IP 192.168.1.100 for ppp0, client B get IP 192.168.1.101 …

Continue reading »

Older posts «