1. 可使用 procstat 查看 Process 詳細詳細資料。
常用選項:
#顯示執行檔資訊
-b Display binary information for the process.
#顯示執行這個 Process 時的 Command Line 參數
-c Display command line arguments for the process.
#顯示 Process 所開啟的檔案相關資訊
-f Display file descriptor information for the process.
2. 可使用 pstree 列出目前執行中的 Process 狀態與相互之間的關係。
2012年6月28日 星期四
FreeBSD 查看 Process 詳細資料
2012年5月30日 星期三
Speed matters a lot!
Amazon: 100 ms of extra load time caused a 1% drop in sales (source: Greg Linden, Amazon).
Google: 500 ms of extra load time caused 20% fewer searches (source: Marrissa Mayer, Google).
Yahoo!: 400 ms of extra load time caused a 5–9% increase in the number of people who clicked “back” before the page even loaded (source: Nicole Sullivan, Yahoo!).
2012年3月26日 星期一
FreeBSD 利用 Xvfb (xorg-vfbserver) 執行 X Window 程式
Xvfb 在 FreeBSD 的 ports 裡面叫 xorg-vfbserver。
安裝 ports:
/usr/ports/x11-servers/xorg-vfbserver
/usr/ports/x11/xkeyboard-config
啟用 Xvfb,並指定 顯示 的 X server。
啟用 Xvfb 於 server 1 並指定第 0 個 screen 為 1920x1080x16
# Xvfb :1 -screen 0 1920x1080x16 &
# setenv DISPLAY :1.0
2012年3月22日 星期四
FreeBSD 中 MySQL InnoDB 檔案損毀無法卸除問題解決
當 MySQL InnoDB 的資料庫檔案損毀造成無法載入,且無法下 Query 時,可以使用參數強制 InnoDB 跳過錯誤處理流程,讓我們可以將資料盡量 Dump 出來,或卸載資料庫。
my.cnf
[mysqld]
innodb_force_recovery = 4
MySQL 官方網站參數說明:
1 (SRV_FORCE_IGNORE_CORRUPT)
Let the server run even if it detects a corrupt page. Try to make SELECT * FROM tbl_name jump over corrupt index records and pages, which helps in dumping tables.
2 (SRV_FORCE_NO_BACKGROUND)
Prevent the main thread from running. If a crash would occur during the purge operation, this recovery value prevents it.
3 (SRV_FORCE_NO_TRX_UNDO)
Do not run transaction rollbacks after recovery.
4 (SRV_FORCE_NO_IBUF_MERGE)
Prevent insert buffer merge operations. If they would cause a crash, do not do them. Do not calculate table statistics.
5 (SRV_FORCE_NO_UNDO_LOG_SCAN)
Do not look at undo logs when starting the database: InnoDB treats even incomplete transactions as committed.
6 (SRV_FORCE_NO_LOG_REDO)
Do not do the log roll-forward in connection with recovery.
2012年3月14日 星期三
FreeBSD xargs 無法處理一個以上參數之替代方案
1.將資料 pipe 給 sed
2.於 sed 中使用 regular expression 切割字串
3.重組字串成 指令 輸出
4.pipe 給 tcsh
example:
# ls */*road | xargs -I @ -n 1 realpath @ | sed 's/\(.*\)\/\(.*\)\/\([0-9]*\)\(.*\)/mv \1\/\2\/\3\4 \1\/\2\/\3_\2_\4/' | tcsh
FreeBSD xargs 中使用 | pipe
使用 xargs 時,若組合出的指令中需要使用到 | pipe,則會發指令無法執行,因為 pipe 後面的東西會被當成一個新的指令。
可使用 tcsh -c 來執行組合出來的指令,以避免此問題。
# echo 'abcdef' | xargs -I @ -n 1 tcsh -c "echo @ | grep 'abc' "
2012年3月13日 星期二
FreeBSD 新增硬碟
*於機器上安裝新硬碟
*檢視 /var/run/dmesg.boot 確認有抓到新硬碟
*以 root 執行 sysinstall
*選 Configure > Fdisk 分割硬碟 (記得 Q 之前要用 W 寫入)
*重開機
*以 root 執行 sysinstall
*選 Configure > Lable 指定分割區名稱 (記得 Q 之前要用 W 寫入) (若非第一次安裝系統,則 Label mount point 不重要)
*編輯 /etc/fstab, 加入新增的分割區資訊
*重開機
2012年2月8日 星期三
FreeBSD 設定 ports 抓取檔案 Server
修改 /etc/make.conf
加入以下設定:
# Port master sites.
#
# If you want your port fetches to go somewhere else than the default
# (specified below) in case the distfile/patchfile was not found,
# uncomment this and change it to a location nearest you. (Don't
# remove the "/${DIST_SUBDIR}/" part.)
#
MASTER_SITE_BACKUP?= \
ftp://ftp.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp5.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp10.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp2.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp3.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp4.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp7.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp8.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp9.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp11.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp12.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/
#
# If you want your port fetches to check the above site first (before
# the MASTER_SITES specified in the port Makefiles), uncomment the
# line below. You can also change the right side to point to wherever
# you want.
#
MASTER_SITE_OVERRIDE?= ${MASTER_SITE_BACKUP}