網頁

2011年12月22日 星期四

FreeBSD IP Alias: Setup 2 or More IP address on One NIC

Set ip alias using ifconfig command line utility

Login as the root user.

Now, use ifconfig command as follows to set alias:
# ifconfig lnc0 192.168.1.5 netmask 255.255.255.255 alias
Persistent IP Alias Configuration

Edit file /etc/rc.conf to setup persistent ip aliasing option by appending following configuration, so that next time FreeBSD comes up (after restart/shutdown) it will create alias for you:
ifconfig_lnc0_alias0="192.168.1.5 netmask 255.255.255.255"

Finally, Restart FreeBSD network service using network restart script:
# /etc/rc.d/netif restart && /etc/rc.d/routing restart
Display alias and real ip using ifconfig lnc0 command:
# ifconfig lnc0

2011年12月21日 星期三

Subversion on NFS

svn repos置放於NFS上時所造成的問題,當commit時發生錯誤,如下:

svn: Commit failed (details follow):
svn: Can't get exclusive lock on file '/storage/openfoundry/repos/ntoutest/db/txn-current-lock': Operation not supported

處理方式
/etc/rc.conf 加入以下三行,重新啟動系統

nfs_client_enable="YES"
rpc_lockd_enable="YES"
rpc_statd_enable="YES"

FreeBSD主機校時與時區設定

主機校時設定:

開機時,就校時乙次:
在 /etc/rc.conf 中加入:
ntpdate_enable="YES"
ntpdate_flags="clock.stdtime.gov.tw"

開機後,定時校時:
crontab 簡介:
在 /etc/periodic/ 資料夾中有三個目錄:

drwxr-xr-x 2 root wheel 1024 10 Giu 21:34 daily
drwxr-xr-x 2 root wheel 512 10 Giu 21:34 monthly
drwxr-xr-x 2 root wheel 512 10 Giu 21:34 weekly

而 /etc/crontab 中亦已定義每日、每週、每月定時分別執行各該目錄下的程序檔案。

我選擇每月定時校時:
編輯 /etc/periodic/monthly/190.ntpdate 檔,內容如下:
#!/bin/sh
echo
echo '主機校時:'
/usr/sbin/ntpdate clock.stdtime.gov.tw

chmod +x /etc/periodic/monthly/190.ntpdate

心血來潮時,手動校時。只有 root 才能做校時設定哦:
ntpdate clock.stdtime.gov.tw

2011年12月14日 星期三

Ubuntu gedit add plugin

Download plugin from Gedit/Plugins
Copy files to .local/share/gedit/plugins/ or /usr/lib/gedit/plugins/
Use plugin from gedit > edit > preferences > plugins > select your plugin.

e.g.
regular expressions plugin
download: regex_replace-gedit3.tar.gz
Copy files to .local/share/gedit/plugins/ or /usr/lib/gedit/plugins/
start gedit > edit > preferences > plugins > put a checkmark on "regular expressions"