2006年12月9日

使用linux 的wget 指令測試proxy是否有cache到頁面

1.proxy沒cache到頁面

--20:49:37-- http://210.65.0.1/report/2006vote/chinatimes/MayorVote.xml?r=19-45
=> `MayorVote.xml?r=19-45'
Connecting to 210.65.0.1:80... connected.
HTTP request sent, awaiting response...
1 HTTP/1.0 200 OK
2 Content-Length: 19613
3 Content-Type: text/xml
4 Last-Modified: Sat, 09 Dec 2006 12:44:04 GMT
5 Accept-Ranges: bytes
6 ETag: W/"bc758bb58f1bc71:3d9"
7 Server: Microsoft-IIS/6.0
8 X-Powered-By: ASP.NET
9 Date: Sat, 09 Dec 2006 12:49:34 GMT
10 X-Cache: MISS from ac200 (沒有cache 到頁面 )
11 Connection: keep-alive
100%[====================================>] 19,613 --.--K/s
20:49:39 (36.68 MB/s) - `MayorVote.xml?r=19-45.2' saved [19613/19613]
2.proxy有cache到頁面

--20:56:50-- http://210.65.0.1/report/2006vote/chinatimes/MayorVote.xml
=> `MayorVote.xml.1'
Connecting to 210.65.0.1:80... connected.
HTTP request sent, awaiting response...
1 HTTP/1.0 200 OK
2 Content-Length: 19613
3 Content-Type: text/xml
4 Last-Modified: Sat, 09 Dec 2006 12:44:04 GMT
5 Accept-Ranges: bytes
6 ETag: W/"bc758bb58f1bc71:3d9"
7 Server: Microsoft-IIS/6.0
8 X-Powered-By: ASP.NET
9 Date: Sat, 09 Dec 2006 12:56:42 GMT
10 Age: 13
11 X-Cache: HIT from ac200 (有cache,ac200是proxy server的hostname)
12 Connection: keep-alive
100%[====================================>] 19,613 --.--K/s
20:56:51 (34.13 MB/s) - `MayorVote.xml.1' saved [19613/19613]
cache控制參數(有可能是proxy server加進去的http header):
  Cache-Control: max-age=60  (cache 60秒,如果超過 60會回304,要求確認是否更新過)
   X-Cache: HIT from ac200  (在ac200 有cache到)
 

2006年11月23日

/etc/rc.d/init.d/xxxxx 的編輯說明,& check process 是否已經在running

#!/bin/bash
#
# /etc/rc.d/init.d/<servicename>
#
# <description of the *service*>
# <any general comments about this init script>


#
# <tags -- see below for tag definitions. *Every line* from the top
# of the file to the end of the tags section must begin with a #
# character. After the tags section, there should be a blank line.
# This keeps normal comments in the rest of the file from being
# mistaken for tags, should they happen to fit the pattern.>

# Source function library.
. /etc/rc.d/init.d/functions

case "$1" in
start)
echo -n "Starting <servicename> services: "
<start daemons, perhaps with the daemon function>
touch /var/lock/subsys/<servicename>
;;
stop)
echo -n "Shutting down <servicename> services: "
<stop daemons, perhaps with the killproc function>
rm -f /var/lock/subsys/<servicename>
;;
status)
<report the status of the daemons in free-form format,
perhaps with the status function>
;;
restart)
<restart the daemons, normally with $0 stop; $0 start>
;;
reload)
<cause the service configuration to be reread, either with
kill -HUP or by restarting the daemons, possibly with
$0 stop; $0 start>
;;
probe)
<optional. If it exists, then it should determine whether
or not the service needs to be restarted or reloaded (or
whatever) in order to activate any changes in the configuration
scripts. It should print out a list of commands to give to
$0; see the description under the probe tag below.>
;;
*)
echo "Usage: <servicename> {start|stop|status|reload|restart[|probe]"
exit 1
;;
esac


Functions in /etc/rc.d/init.d/functions


daemon [+/-nicelevel] program [arguments] [&]


Starts a daemon, if it is not already running.

Does other useful things like keeping the daemon from dumping core if it terminates unexpectedly.


killproc program [signal]


Sends a signal to the program; by default it sends a SIGTERM,

and if the process doesn't die, it sends a SIGKILL a few seconds later.

It also tries to remove the pidfile, if it finds one.


pidofproc program


Tries to find the pid of a program; checking likely pidfiles,

using the pidof program, or even using ps. Used mainly from within other functions in this file, but also available to scripts.


status program


Prints status information. Assumes that the program name is the same as the servicename.


Tags.


# chkconfig: <startlevellist> <startpriority> <endpriority>


Required. <startlevellist> is a list of levels in which the service should be started by default.

<startpriority> and <endpriority> are priority numbers.

For example: # chkconfig: 2345 20 80 Read 'man chkconfig' for more information.

Unless there is a VERY GOOD, EXPLICIT reason to the contrary,

the <endpriority> should be equal to 100 - <startpriority>


# description: <multi-line description of service>


Required. Several lines of description, continued with '\' characters.

The initial comment and following whitespace on the following lines is ignored.


# description[ln]: <multi-line description of service in the language \ # ln, whatever that is>


Optional. Should be the description translated into the specified language.


# processname:


Optional, multiple entries allowed. For each process name started by the script,

there should be a processname entry. For example, the samba service starts two daemons:
# processname: smdb
# processname: nmdb


# config:


Optional, multiple entries allowed. For each static config file used by the daemon, use a single entry. For example:
# config: /etc/httpd/conf/httpd.conf
# config: /etc/httpd/conf/srm.conf

Optionally, if the server will automatically reload the config file if it is changed,

you can append the word "autoreload" to the line:
# config: /etc/foobar.conf autoreload


# pidfile:


Optional, multiple entries allowed.

Use just like the config entry, except that it points at pidfiles.

It is assumed that the pidfiles are only updated at process creation time, and not later.

The first line of this file should be the ASCII representation of the PID;

a terminating newline is optional. Any lines other than the first line are not examined.

# probe: true

# Check for postmaster already running...
pid=`pidof postmaster`
if [ $pid ]
then
echo "Postmaster already running."
else
run xxx <<<<< else 要run 的指令
fi <<<<等於endif的意思

為網路卡設置固定的速度

1) 檢查網路交換器 (或路由器),並將其設定為網路卡欲使用的速度 (它有可能被設成 100)。
2) 修改檔案: /etc/sysconfig/network-scripts/ifcfg-ethX
並且加入下面這行:
ETHTOOL_OPTS="speed 1000 duplex full"
3) 重新啟動網路卡程序,或者重新開機。

如何建立可開機的 USB 隨身碟?

如何建立可開機的 USB 隨身碟?

組態資訊
Redhat Enterprise Linux 2.1 版及 3.0 版
解決方法

請依照下列步驟建立可開機的 USB 隨身碟:
1. 以 /dev/loop 掛載 (Mount) ISO 映像檔:
# mkdir /mnt/tmpmount
# mount -o,loop=/dev/loop1 boot.iso /mnt/tmpmount
2. 將檔案從掛載點 (Mount Point) 複製到一個暫存的子目錄:
# mkdir /tmp/usbimage
# cp -Rv /mnt/tmpmount/isolinux/* /tmp/usbimage/
3. 將 isolinux.img 和 isolinux.cfg 重新命名為 syslinux.img 和 syslinux.cfg:
4. 建立一個足夠容納這些檔案的空白檔案:
# dd if=/dev/zero of=/root/usbboot.img bs=1M count=7
以上命令會建立一個 7MB 的檔案,這應該夠大了。
5. 在 usbboot.img 上建立一個檔案系統:
# mkfs.vfat usbboot.img
6. 卸載 (Unmount) boot.iso 並掛載 usbboot.img:
# ummount /mnt/tmpmount
# mount -o,loop=/dev/loop1 /root/usbmount.img /mnt/tmpmount
7. 將檔案複製到已掛載的檔案系統:
# cp -Rv /tmp/usbimage/isolinux/* /mnt/tmpmount
8. 卸載 /mnt/tmpmount:
# umount /mnt/tmpmount
9. 將 sbmount.img 設成 "可開機":
# syslinux /root/usbboot.img
10. 插入 USB 隨身碟,然後將開機映像檔置入:
# dd if=/root/usbboot.img of=/dev/sda bs=1M
完成之後,您便擁有一個可開機的 USB 隨身碟。此隨身碟可在 DL 140、145、3xx G4 等
系統上使用。請進入 BIOS 設定,將 USB 設成開機裝置。

新增phpmyadmin權限控制;新增mysql user

1.修改phpMyAdmin的設定檔config.inc.php
      -設定 phpMyAdmin 認證模式:$cfg['Servers'][$i]['auth_type'] = 'http';
      -改為http表示透過瀏覽器輸入帳號及密碼進行MySQL的認證,並把$cfg['Servers'][$i]['user']  &['password']='';  <===原設定拿掉
      -若用config,則需要將密碼寫入檔案,設定如下
           $cfg['Servers'][$i]['user'] = 'rdcenter';
           $cfg['Servers'][$i]['password'] = 'rdxxxx';
2.新增mysql user,並給予權限
      mysql> grant all privileges on net00db.* to net00@localhost IDENTIFIED BY '12345678' ;
      mysql> grant select on TotalClickBoard.* to cti@localhost IDENTIFIED BY '16318448' ;
      mysql> FLUSH PRIVILEGES ; 

php頁面都是空白的

修改php.ini
short_open_tag = off
改成 ON

尋找N天前的檔案,並做刪除

find . -mtime 8 -exec rm -f {} \; 刪除8天前(那一天)的檔案
find . -mtime 5 -exec ls -la {} \; list出5天前(那一天)的檔案
find . \! -cnewer dfk661Gn08001163 -exec rm -f {} \; 刪除比dfk661Gn08001163還舊的檔案( \! -cnewer=-cnewer的相反)

Linux 檢查檔案數目

ls -la |more
ls -la | wc -l
用在檢查大量的mail queue時很有用.

如何測試ide硬碟性能及增加IDE硬碟效能

使用hdparm -tT /dev/hdX就可以测试硬碟的buffer-cache reads和buffered disk reads两个数据,可以用来当作硬盘性能的参考。

同时使用hdparm -c3 /dev/hdaX还能设置硬盘以32bit传输,以加快数据传输的速度。



hdparm -c3 -d1 -m16 -X66 /dev/hda 目前使用ide硬碟的機器都要設定以增加速度





powered by performancing firefox

nslookup簡易使用方法

無法查看此摘要。請 按這裡查看文章。

Dns server的建立紀錄方法

Dns server的建立紀錄方法



一、 開啟DNS管理員。

二、 選擇所屬DNS伺服器,或是新增伺服器選擇某一DNS伺服器。

三、 加入正查新區域:選擇新區域,選擇主機,鍵入區域名稱後直接按tab鍵,即會自動產生區域檔案,再下一步完成動作。(ns紀錄要指定到公司控管的primary&secondary dns server)

四、 加入反查區域:選擇新區域,選擇主機,鍵入區域名稱後(如ip是210.200.39.19,區域名稱即是39.200.210.in-addr.arpa)直接按tab鍵即會自動產生區域檔案(39.200.210.in-addr.arpa.dns),再下一步完成動作。

五、 加入紀錄前先確認反查紀錄中有無所要加入紀錄的IP反查區域,(如加入的IP是210.200.39.19,就應該有一反查區域39.200.210.in-addr.arpa),確認後選取加入紀錄的區域,選取新紀錄,輸入正確資料後完成動作。







powered by performancing firefox

Windows Dns server的災後重建

Dns server的災後重建

備份:\winnt\system32\dns下所有資料備份。

還原:在有dns服務的機器上,停止dns service,還原\winnt\system32\dns 下所有資料,啟動DNS Service即完成。







powered by performancing firefox

2006年11月22日

二種SAN的差異,

二種SAN的差異

FC SAN是封閉式的網路,

並不與現有的IP網路混用,不走IP所以不能混用,

IP SAN(即Iscsi),是仿照SAN的架構研發出來的新的Storage架構,

使用IP去Attach Storage,可以與現有的IP網路混用,所以彈性較大,

也可當NAS使用,但NAS說穿了只是一個file sharing server,

只能做到File level,

不像FC SAN和IP SAN可以做到Block level(for exchange or SQL使用)

二種SAN也各有優缺點,需視不同需求而各有選擇.



FC SAN:

優點:安全,獨立頻寬,穩定

缺點:貴(HBA卡,FC switch),彈性不大



IP SAN:

優點:整體架構便宜(可使用一般ethernet 網卡,switch,media),彈性大,

缺點:有安全疑慮(走IP網路),效能還是追不上FC SAN