Posts

Showing posts from August, 2007

Doc - Hobbit

Image
Hobbit is a system for monitoring servers and networks. It has a great deal of inspiration from the Big Brother monitor, but unlike Big Brother it is designed to work well whether you need to monitor small network with just a handful of hosts, or large networks with thousands of hosts.

Hobbit monitors your hosts, your network services, and anything else you configure it to do via extensions. Hobbit will periodically generate requests to network services - http, ftp, smtp and so on - and record if the service is responding as expected. Through the use of agents installed on the servers, you can also monitor local disk utilisation, logfiles and processes.

Manual

Speed up boot time under Windows

Image
StartUpLite helps you disable or remove all known unnecessary startup entries from your machine, and thus quicken the startup procedure of your system.

Linux - Download in backgroud

Method 1:
wget -bqco wget.log http://url/file.iso
-b : run in background
-o : log output to wget-log.
-q : Turn off Wget’s output
-c : Resume broken download i.e. continue getting a partially-downloaded file.
Method 2:
nohup wget http://url/file.iso &exit

Linux - Available packages from Internet

Red Hat Enterprise Linux or CentOS 5
yum list available

Linux - Disable ctrl+alt+del Linux

To disable the function of reboot by ctrl+alt+del
vi /etc/inittab
#comment out the linux
# ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
init q

Linux - Domain Expiration Check Shell Script

A very useful script to manage Domain
http://www.cyberciti.biz/tips/domain-check-script.html

Linux - Change file name on multiple files

Method 1:
for oldname in *.mp3; do mv $oldname `basename $oldname .mp3`.mp4; doneMethod 2:
rename 's/\.mp3$//' *.mp4

Free Programming e-Books

A webpage collecting the links of FREE ebook.
http://www.appsapps.info/books/

Linux - 繁體 in SSH / FTP / Samba

vi /etc/sysconfig/i18nLANG="zh_TW.Big5"
SYSFONT="latarcyrheb-sun16"
SUPPORTED="zh_TW.Big5:zh_TW:zh"
vi /etc/samba/smb.conf
#Add the lines within Global section
unix charset = cp950
dos charset = cp950
# sync;sync;reboot
Result:
1. SSH can read T.Chi
2. FTP can read T.Chi
3. Samba can read T.Chi

Computer Sticker

Image
Computers are only not designed for the Microsoft Windows. You may remove Microsoft sticker from your computer and choose your own sticker to replace it.
http://www.pikao.nierox.com/

Oracle - Start & Shutdown

Shell Command Start
# $ORACLE_HOME/bin/dbstart

Using Server Manager Start
# svrmgrl
SVRMGR> connect internal
SVRMGR> startup [ DBA | FORCE | SHARED | EXCLUSIVE ]

Shell Command Shutdown
# $ORACLE_HOME/bin/dbshut

Using Server ManagerShutdown
# svrmgrl
SVRMGR> connect internal
SVRMGR> shutdown [ normal | immediate | abort ]

Database Tools

Image
SQLTools is a light weighted and robust tool for ORACLE database development.
SQLTools is released under the GNU General Public License (GPL).

Toad is a tool that improves the productivity of developers and DBAs by providing an easy-to-use development environment.

Linux - Explore and Extract ISO

mkdir /mnt/iso
mount -o loop -t iso9660 .iso /mnt/iso

Linux - Solution to "Argument list too long"

# find . -name 'access*' | xargs rm

Linux - Firefox/Thunderbird Memory Leak

To solve a known memory leak problem of Firefox/Thunderbird, i.e. large amount of memory consumption, it is a way to release memory from RAM to Harddisk when minimizing to system tray.

Install Add-ons Minimize To Tray EnhancerConfigure Firefox/Thunderbird(Firefox) Type in about:config in URL bar
(Thunderbird) Type > Options > Advanced > General > Click [Config Editor]
Right Click in the page and select New > Boolean.
Enter config.trim_on_minimize. Press Enter.
Select True and then press Enter.
Restart Firefox/Thunderbird

Linux - tcptrack

Download from:
http://dag.wieers.com/rpm/packages/tcptrack/tcptrack-1.1.5-1.2.el5.rf.i386.rpm

# tcptrack -i eth0
# tcptrack -i eth0 port 25
# tcptrack -i eth0 src or dst 76.11.22.12

Linux - rsync backup

伺服器端
啟動備份伺服器
$ vi /etc/xinetd.d/rsync
disable = no

$ service xinetd restart

設定備份伺服器
$ vi /etc/rsync.conf
#中括號內的文字是自訂的備份代號,設定檔內可以有多個備份代號,每個代號之下可以有自已的設定
[backup01]
#備份之檔案的存放路徑 (請先建立好路徑,並且要讓下面的 uid 及 gid 可以寫入檔案)
path = /var/backup/backup01
#驗證的用戶名稱 (此名稱只需存在於密碼檔裡面即可)
auth users = backup01
#執行程式時所使用的用戶及群組名稱,同時也會成為備份之後檔案的擁有者及擁有群組
uid = root
gid = root
#密碼檔的位置
secrets file = /etc/rsync.password
read only = no

$ vi /etc/rsync.password
backup01:password

$ chmod 600 /etc/rsync.password


Client 端
rsync 做為同步處理時,常用的參數如下:
* -a, --archive: archive mode, equivalent to -rlptgoD *
最常被使用的參數,相當於同時使用 "-rlptgoD"
* -v, --verbose: increase verbosity *
* -R, --relative: use relative path names
備份後,使用 Client 端完整的路徑,不加此參數,則為相對路徑
* -H, --hard-links: preserve hard links *
* -S, --sparse: handle sparse files efficiently *
* -z, --compress: compress file data *
壓縮傳輸的資料,以減少傳輸量
* --delete: delete files that don’t exist on sender *
進行同步時,Client 端如果刪掉檔案,則備份伺服器也同時刪除該檔案,以保持…

Linux - System config & hardware info

Current Language:
$ set | egrep '^(LANG|LC_)'

Installed device drivers (modules)
$ lsmod

Information about an X server:
$ xdpyinfo

User shell name:
$ ps -p $$ | tail -1 | awk '{ print $4 }'

Dump Linux kernel variables
$ /sbin/sysctl -a

Running Linux kernel version:
$ uname -mrs
$ uname -a
$ cat /proc/version

Display list of all open ports
$ netstat -tulpn

Linux - grep usage

recursive grep
$ grep -R "192.168.1.1" *

ignore word case grep
$ grep -i "car" /etc/passwd
(i.e. including car, CAR, Car...)

search words only
$ grep -w "car" /path/to/file
(i.e. match only car word)

exclude grep
$ grep -v car /path/to/file

Linux - iptables resources

Image

Linux - Serial Console (Method 1 - Enable serial console on bootup)

Linux - Serial Console (Method 1 - Enable serial console on bootup)
Linux - Serial Console (Method 2 - Enable serial console on bootup)

Find Serial Port
# dmesg | grep tty
ttyS0 at 0x03f8 (irq = 4) is a 16550A

# setserial -g /dev/ttyS0
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4

Configure inittab
# vi /etc/inittab
(add the lines)
# Run agetty on COM1/ttyS0 and COM2/ttyS1
s0:2345:respawn:/sbin/agetty -L -f /etc/issueserial 9600 ttyS0 vt100

# vi /etc/issueserial
(add the lines)
Hello
Connected on \l at \b bps
\U

# init q

Check the availability of change
# ps -ef | grep agetty

Allow login as root via serial
# vi /etc/securetty
console
ttyS0
ttyS1
vc/1
...

(Optional) Configure serial port as system console
# vi /etc/grub.conf
# grub.conf generated by anaconda
#boot=/dev/hda
default=0
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Red Hat Linux (2.4.20-24.9)
root (hd0,0)
kernel /vmlinuz-2.4.20-24.9 ro root=LABEL=/ console=ttyS0,9600
initrd /initrd-2.4.20-24.9.img

(Importa…

Linux - Simple iptables script

To separate iptables' log from messages:
# vi /etc/syslog.conf
add the following lines
#IPTables logging
kern.debug;kern.info /var/log/firewall
# service syslog restart

Write iptable script:
# vi /opt/iptables.sh
add the following lines
#!/bin/ksh

#= Basic System conf ==============#
#==================================#

ip=192.168.1.123

##### Load Modules
modprobe ip_tables
modprobe ip_conntrack_ftp
modprobe ipt_state
modprobe iptable_filter

##### Enable broadcast echo Protection
#echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_broadcasts

#= Basic Rules ====================#
#==================================#

##### Flush all tables
iptables --flush
iptables -t nat --flush
iptables -t mangle --flush

##### Debug Log
#iptables -A INPUT -j LOG --log-prefix " *** Firewall Log *** "

##### create Chain
iptables -X LOG_ACCEPT
iptables -X LOG_DROP
iptables -N LOG_ACCEPT
iptables -N LOG_DROP
##### Default DROP all connections
iptables --policy INPUT DROP
iptables --policy OUTPUT DROP
iptables --policy FORWARD D…