Category Archives: Network service

Turn Dropbox into subversion repository storage / 把 Dropbox 拿來做 svn 的儲存空間


  • ENV: Ubuntu server , home directory 下裝好 Dropbox
  • 在 dropbox dir tree 下建好 svn 的 repo. tree —–> ex: file:///home/rimmon/Dropbox/SVN
  • 用這個 CHECKOUT COMMAND 把 source checkout 出來
    svn co file:///home/rimmon/Dropbox/SVN _SRC_IOS
  • 這樣做好處是 dropbox 的同步機制可以幫忙把檔案 跟 repo. 複製到其他地方去(算是共用/備份)
  •  maintain source 時 … 需要用 ssh 進去 ubuntu server , 下 svn command

configure for syslog-ng , syslog-ng.conf , log server , remote log , syslog


// ----------------

Server: /etc/syslog-ng/syslog-ng.conf :

source remote_host {

destination my_host { file("/var/log/$YEAR$MONTH$DAY.log"); };

log {

// —————-


Client: /etc/syslog-ng/syslog-ng.conf :

source src { unix-stream("/dev/log"); internal(); };

destination remote_server { udp("" port(514)); };

log {

// —————- 改良版的 log server , 日期/時間比較容易看, remote server 的 IP address


其中 flush_lines 可以改大一點增加 log 的 performance ….

options {

source remote_host {

template t_rewritetime {
  template("${YEAR}-${MONTH}-${DAY} , ${HOUR}:${MIN}:${SEC} , ${HOST} , \"${MSG}\"\n");

destination my_host {
  file("/var/log/$YEAR$MONTH$DAY-$HOUR.log" template(t_rewritetime) );

log {

// —— // —————- 改良版的 client , 保留一份 log 在本機備查

source src { unix-stream("/dev/log"); internal(); };

destination remote_server {
  udp( "" port(514) );

log {

// —–

log sample :

root@log_server:/etc/syslog-ng# tail -f /var/log/20111024-17.log
2011-10-24 , 17:21:06 , 172.25.x.107 , "crontab[12974]: (root) LIST (root)"
2011-10-24 , 17:22:01 , 172.25.x.108 , "CRON[4150]: pam_unix(cron:session): session opened for user root by (uid=0)"
2011-10-24 , 17:22:01 , 172.25.x.108 , "/USR/SBIN/CRON[4151]: (root) CMD (/usr/sbin/ntpdate 172.25.x.45)"
2011-10-24 , 17:22:01 , 172.25.x.108 , "CRON[4150]: pam_unix(cron:session): session closed for user root"
2011-10-24 , 17:22:49 , 172.30.x.43 , "sshd[5533]: Accepted keyboard-interactive/pam for monster from 172.30.x.89 port 56790 ssh2"
2011-10-24 , 17:22:49 , 172.30.x.43 , "sshd[5533]: pam_unix(sshd:session): session opened for user monster by (uid=0)"
2011-10-24 , 17:22:51 , 172.30.x.43 , "sshd[5533]: pam_unix(sshd:session): session closed for user monster"

// —- 測試 syslog 的 C – sample code :

用 C 的 sample code  

*PS: ubuntu 要先 apt-get update 再裝 apt-get install gcc build-essential

…. // —- 測試 syslog 的 PHP – sample code : , 跟 C 的版本長得一樣 ….

用 PHP 的 sample code

openlog("myScriptLog", LOG_PID | LOG_PERROR, LOG_LOCAL0);
syslog(LOG_WARNING, "Unauthorized client...." );


URL: syslog-ng performance tuning 1.



email checker

也許根據以下的 smtp command 可以用來 check email 名單的正確性


Resolving host name ""...
Connecting to host address ""...
S 220 ESMTP m8si9351085icw.142
S 250 at your service
S 250 2.1.0 OK m8si9351085icw.142
S 250 2.1.5 OK m8si9351085icw.142
S 354 Go ahead m8si9351085icw.142
This host states that the address is valid.

amazon aws ami LAMP / NGINX / PHP / memcache steps

// —–

sudo apt-get install nginx php5-fpm php5-mysql
cd /etc/init.d/
sudo service apache2 stop
sudo update-rc.d -f apache2 remove

Install Memcached
sudo apt-get install memcached libmemcached-dev php5-memcached php5-memcache

// ====================

Getting a new virtual machine up and running from the default AMI is easy.  Here’s my cookbook:
Install basic services

    yum install mysql mysql-server mysql-devel
    yum install httpd httpd-devel
    yum install php php-devel php-mysql php-gd php-dom php-pear php-json
    yum install svn

Configure those services to start at boot

    chkconfig –level 345 httpd on
    chkconfig –level 345 mysqld on
    chkconfig –list

Install APC

I couldn’t find a package, and this bug report explains why we have to use the beta.

    yum install gcc pcre-devel
    pecl install apc-beta
    echo > /etc/php.d/apc.ini

Install memcached

    yum install libevent libevent-devel
    curl -O
    cd memcached-1.4.5
    make ; make install
    /usr/local/bin/memcached -u nobody -d -m 30 -l -p 11211

// ----
[root@ip-10-130-9-23 log]# cat /etc/fstab 
LABEL=/     /           ext4    defaults,noatime  1   1
tmpfs       /dev/shm    tmpfs   defaults        0   0
devpts      /dev/pts    devpts  gid=5,mode=620  0   0
sysfs       /sys        sysfs   defaults        0   0
proc        /proc       proc    defaults        0   0
[root@ip-10-130-9-23 log]# cat /etc/mtab 
/dev/xvda1 / ext4 rw,noatime 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0


Apache 是 Internet 世界最偉大的 project

以前 打 可能就是看到 apache web server 的 download , document ….等等, 但隨著越來越多開發者把他們的 project 標記成 apache license , apache 於是變成一個巨大的 project 集中地 – The Apache Software Foundation ….

apache web server 是排名第一的 web server 這不用說, 今天認識了 Lucene , Solr 這個應該算是 apache 第二大

Apache Lucene Java 分類是 database

Apache Solr 是被分類在 web-framework, network-server


FreeBSD + apache with large connection settings

solved 如下:

一、  網站的 Search功能因為使用 Ajax的方式,在大量User使用下,造成 Mysql 連線問題而影響 Apahce.

二、  因為新網站為全新製作,所有舊有的網址(包含 Search Agent、各大討論區、子公司…)會全部導回首頁 (Rewrite)…

在大量存取下,短時間產生Mysql、Apache連線,影響mysql與apache 的效能…




problem: 大量出現…

Approaching the limit on PV entries, consider increasing either the vm.pmap.shpgperproc or the vm.pmap.pv_entry_max

===> MaxClients  設太大


FreeBSD: append to /etc/sysctl (or you can use sysctl -w to add these)



一、 網站的 Search功能因為使用 Ajax的方式,在大量User使用下,造成 Mysql 連線問題而影響 Apahce.

二、 因為新網站為全新製作,所有舊有的網址(包含 Search Agent、各大討論區、子公司…)會全部導回首頁 (Rewrite)

在大量存取下,短時間產生MysqlApache連線,影響mysqlapache 的效能…

Amazon AWS EC2 service / cloud / 雲端

Dear EC2 Customer,
You recently reached a limit on the volume of email you were able to send out of SMTP port 25 on your instance:

Instance ID: i-9b8924ce
* IP Address:
* Start date: 2011-06-01 22:47 +0000

In order to maintain the quality of EC2 addresses for sending email, we enforce default limits on the amount of email that can be sent from EC2 accounts. If you wish to send larger amounts of email from EC2, you can apply to have these limits removed from your account by filling out our online request form.

If you are unaware of your instance having sent emails, we advise checking your instance application(s) to confirm that this activity was intended. It is your responsibility to ensure that your instances and all applications are secured against unauthorized use. For suggestions on securing your instances, visit

Your Amazon Web Services EC2 team


amzn-ami-2011.02.1.x86_64-ebs (ami-6ef08e3c)
Description: Amazon Linux AMI x86_64 EBS
Status: available
Platform: Amazon Linux
Image size: 8 GB
Visibility: Public
Owner: amazon (137112412989)

processor    : 0
vendor_id    : GenuineIntel
cpu family    : 6
model        : 23
model name    : Intel(R) Xeon(R) CPU           E5430  @ 2.66GHz
stepping    : 10
cpu MHz        : 2666.760
cache size    : 6144 KB
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu tsc msr pae cx8 cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht pbe syscall nx lm constant_tsc up arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 lahf_lm tpr_shadow vnmi flexpriority
bogomips    : 5333.52
clflush size    : 64
cache_alignment    : 64
address sizes    : 38 bits physical, 48 bits virtual
power management:

Install MySQL

# yum install mysql mysql-server mysql-libs

Start the service and configure it to start automatically at boot time

# /sbin/service mysqld start

# chkconfig –levels 235 mysqld on

# yum install httpd php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
# /etc/init.d/httpd restart
# chkconfig –levels 235 httpd on


/etc/ssh/sshd_config and set “PasswordAuthentication” to YES


Amazon Linux AMI :



Amazon Machine Images = AMI


Depending on your distribution, you can likely install everything you need via yum or apt-get; Apache Friends XAMPP, BitNami LAMPStack, BitNami LAPPStack


Amazon EC2 AMIs

BitNami LAMPStack



參考設定: ADSL / DDWRT 動態 IP 用 DynDNS 設定 DNS 及 Google Apps


/home/ec2-user/inadyn/bin/linux/inadyn –username userid –password userpassword –alias &


amazon linux AMI : install LAMP command :

yum install httpd php php-mysql php-gd  php-pear php-xml php-xmlrpc





2010. Nov 26, : 原來這就是 Amazon Elastic Compute Cloud (Amazon EC2) 呀…..


URL : Amazon 送的網站 , 申請很簡單, 一下子就有 free 的 VM 可用囉.

Continue reading Amazon AWS EC2 service / cloud / 雲端