使用 less 指令時有顏色顯示
作者:cross 日期:2009-01-10 23:32
安裝必要套件
Quote: http://linuxtoy.org/archives/less-highlight.htmlyum install source-highlight
設定環境變數 vi ~/.bashrc首先安裝 source-highlight
(這個工具主要用途是將文件轉換為語法高亮的 html 頁面,有興趣的話可以試一下)
馬上用,兩種方式# 加入
PAGER='less -X -M'
export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s"
export LESS=' -R '
1。source .bashrc
2。su
再來執行 less xxx.sh 就可以看到有顏色的了
不過 less /var/log/messages 就沒有顏色了
Nagios 監控通知概念
作者:cross 日期:2008-12-19 10:23
host 的 check-host-alive 使用 check_interval 5,每五分鐘間隔檢查,當發生第一次不 ok 時,檢查間隔變為每10秒一次,檢查十次不ok,變為 HARD 狀態發送通知
check_interval 5
max_check_attempts 10
notification_interval 25
nagios.log
2008-12-02.10:11:45 [1228183905] HOST ALERT: ssorc.tw;DOWN;SOFT;1;CRITICAL - Plugin timed out after 10 seconds
2008-12-02.10:11:55 [1228183915] HOST ALERT: ssorc.tw;DOWN;SOFT;2;CRITICAL - Plugin timed out after 10 seconds
2008-12-02.10:12:05 [1228183925] HOST ALERT: ssorc.tw;DOWN;SOFT;3;CRITICAL - Plugin timed out after 10 seconds
2008-12-02.10:12:15 [1228183935] HOST ALERT: ssorc.tw;DOWN;SOFT;4;CRITICAL - Plugin timed out after 10 seconds
2008-12-02.10:12:25 [1228183945] HOST ALERT: ssorc.tw;DOWN;SOFT;5;CRITICAL - Plugin timed out after 10 seconds
2008-12-02.10:12:35 [1228183955] HOST ALERT: ssorc.tw;DOWN;SOFT;6;CRITICAL - Plugin timed out after 10 seconds
2008-12-02.10:12:45 [1228183965] HOST ALERT: ssorc.tw;DOWN;SOFT;7;CRITICAL - Plugin timed out after 10 seconds
2008-12-02.10:12:55 [1228183975] HOST ALERT: ssorc.tw;DOWN;SOFT;8;CRITICAL - Plugin timed out after 10 seconds
2008-12-02.10:13:05 [1228183985] HOST ALERT: ssorc.tw;DOWN;SOFT;9;CRITICAL - Plugin timed out after 10 seconds
2008-12-02.10:13:15 [1228183995] HOST ALERT: ssorc.tw;DOWN;HARD;10;CRITICAL - Plugin timed out after 10 seconds
2008-12-02.10:13:15 [1228183995] HOST NOTIFICATION: nagios-admin-email-cross;ssorc.tw;DOWN;host-notify-by-email;CRITICAL - Plugin timed out after 10 seconds
當 Host DOWN 狀態,有其它監控服務時,比方說是 HTTP,此時也是 Critical,它只有呈現紅色顯示,並不會發送通知,
Linux 上常發生的問題 Out Of Memory, oom-killer
作者:cross 日期:2008-12-03 18:43
引用: http://www.admin99.net/read.php/303.htm
OOM是Out of Memory的簡寫,也就是內存不足。出現該問題的原因有很多,如程序內存泄漏等。內存泄漏問題可以通過定時地終止和重啟有問題的程序來發現和解決。在比較新的Linux內核版本(比如2.6)中,有一種名為OOM(Out Of Memory )殺手的算法,它可以在必要時執行Kill而殺掉一些程序。
比較變態的是,oom-killer只考慮lowmemory而不考慮highmemory,即便這個時候物理內存還有很多free或者cached或者buffer,只要swap不足,便會執行oom-killer。
簡單怀疑swap空間會不會有什麼問題?重建一些swap,權且試試看
先移除原來的swap區
swapoff /dev/sda3
創建/swap做為新的swap區,新swap分區的大小是4G,為了以后同樣生效,不要忘了編輯/etc/fstab文件。
dd if=/dev/zero of=/swap bs=1024 count=$[1024 * 1024 * 4]
終端機底下文字模式的魔術方塊 vitetris
作者:cross 日期:2008-12-03 11:14
vitetris
This is a text-mode Tetris clone which I wrote for the Linux terminal. There are now versions for Windows and DOS as well, and it should compile fine on any Unix-like system.
Gameplay is much like the early Tetris games by Nintendo.
Terminal-based Tetris for Linux
openssl 指令 (續) windows 的 pfx、p12 篇
作者:cross 日期:2008-11-21 16:53
續: http://ssorc.tw/rewrite.php/read-42.html
照我的理解 p12 跟 pfx 差不多是一樣的東西
而它是包含了 crt 跟 key,給 windows 用的
pfx 從 windows 匯出只有包含 crt,不知道怎麼包含 key
不過我從 openssl 來下手
轉成 pem 就可以看到 crt 及 key 了
openssl pkcs12 -in server.pfx -out server.pem -nodes
server.pem 長這樣 ↓
查看 rpm 檔案內容
作者:cross 日期:2008-11-18 19:55
rpm -ql openssl
查未安裝的套件內容/lib/libcrypto.so.0.9.7a
/lib/libssl.so.0.9.7a
/usr/bin/openssl
/usr/share/doc/openssl-0.9.7a
/usr/share/doc/openssl-0.9.7a/CHANGES
/usr/share/doc/openssl-0.9.7a/FAQ
/usr/share/doc/openssl-0.9.7a/INSTALL
/usr/share/doc/openssl-0.9.7a/LICENSE
/usr/share/doc/openssl-0.9.7a/NEWS
/usr/share/doc/openssl-0.9.7a/README
/usr/share/doc/openssl-0.9.7a/c-indentation.el
/usr/share/doc/openssl-0.9.7a/openssl.txt
/usr/share/doc/openssl-0.9.7a/openssl_button.gif
/usr/share/doc/openssl-0.9.7a/openssl_button.html
rpm -qpl openssl-0.9.7a-43.17.el4_6.1.i686.rpm
/lib/libcrypto.so.0.9.7a
/lib/libssl.so.0.9.7a
/usr/bin/openssl
/usr/share/doc/openssl-0.9.7a
/usr/share/doc/openssl-0.9.7a/CHANGES
/usr/share/doc/openssl-0.9.7a/FAQ
/usr/share/doc/openssl-0.9.7a/INSTALL
/usr/share/doc/openssl-0.9.7a/LICENSE
/usr/share/doc/openssl-0.9.7a/NEWS
/usr/share/doc/openssl-0.9.7a/README
/usr/share/doc/openssl-0.9.7a/c-indentation.el
Samba 設定垃圾筒
作者:cross 日期:2008-11-12 15:09




