Saturday, November 17, 2007

centos 4.4 snapshot create error

1. error message:
snapshot: Required device-mapper target(s) not detected in your kernel

solution:
manually load dm_snapshot module as this:

modprobe dm-snapshot

Thursday, November 8, 2007

Configure Linux or Windows connection to remote cups printer

Linux:

use IPP
format: ipp://ip or hostname/printers/PRINTERNAME

Windows/MacOS
add printer, use url http://ip or hostname:631/printers/PRINTERNAME

server side configuration for http printing
First, edit file /etc/cups/mime.types to enable printing via http, remove the hash mark # at the beginning of the following line:
#application/octet-stream

Next, edit the file /etc/cups/mime.convs to remove the hash mark the the beginning of the following line:
#application/octet-stream application/vnd.cups-raw 0

Troubleshooting Windows printing to cups server
access_log
error_log
page_log

Monday, November 5, 2007

use NFS/http to create yum repository

YUM Server:
1. download and install createrepo rpm from http://dag.wieers.com/rpm/packages/createrepo/
or you can install rpmforge rpm from http://dag.wieers.com/rpm/FAQ.php#A1
after that, if it's RHEL, you might need to 'yum install createrepo', if it's centos, it might be already there.
2. on yum server, you need NFS and createrepo as follows:
[root@mars rh5]# more /etc/exports
/data/centos5 *(ro,sync,root_squash,anonuid=65534,anongid=65534)
/data/rh5 *(ro,sync,root_squash,anonuid=65534,anongid=65534)

[root@mars rh5]# ls
1 3 5 repodata rhel-5-server-i386-disc1.iso rhel-5-server-i386-disc3.iso rhel-5-server-i386-disc5.iso
2 4 md5sum rh5.md5 rhel-5-server-i386-disc2.iso rhel-5-server-i386-disc4.iso tmp

[root@mars rh5]# more /etc/modprobe.conf
alias eth0 e100
alias scsi_hostadapter aic7xxx
alias scsi_hostadapter1 aacraid
options loop max_loop=64
(note: if you didn't put the last option, you don't have to reboot server actualy, just umount all loop devides and 'rmmod loop' , then add above line, run 'modprobe loop' to automatically create /dev/loop8-63 devices

3. mount all iso files as loopback
[root@mars yum.repos.d]# df -h | grep rh5
/data/rh5/rhel-5-server-i386-disc1.iso
630M 630M 0 100% /data/rh5/1
/data/rh5/rhel-5-server-i386-disc2.iso
631M 631M 0 100% /data/rh5/2
/data/rh5/rhel-5-server-i386-disc3.iso
630M 630M 0 100% /data/rh5/3
/data/rh5/rhel-5-server-i386-disc4.iso
629M 629M 0 100% /data/rh5/4
/data/rh5/rhel-5-server-i386-disc5.iso
224M 224M 0 100% /data/rh5/5
4. put all commands to /etc/rc.d/rc.local
cd /data/centos5
mount -o loop CentOS-5.0-i386-bin-1of6.iso 1
mount -o loop CentOS-5.0-i386-bin-2of6.iso 2
mount -o loop CentOS-5.0-i386-bin-3of6.iso 3
mount -o loop CentOS-5.0-i386-bin-4of6.iso 4
mount -o loop CentOS-5.0-i386-bin-5of6.iso 5

5. configureing http alias so that yum client can use http url as yum server location
[root@mars httpd]# pwd
/etc/httpd
[root@mars httpd]# grep rh5 conf/httpd.conf
Alias /rh5 "/data/rh5"

6. on yum client /etc/fstab, put
[root@hphost1 kernels]# grep rh5 /etc/fstab
mars:/data/rh5/ /nfs/rh5 nfs defaults 1 2

Tuesday, October 30, 2007

disown, nohup,screen,script,mkfifo

1. nohup command > output.txt &
nohup command > /dev/null &

2. disown -h jobnumber
disown -ar

3. screen
screen -list
screen -Dr number
screen -dm -S name -t titlename

4. script -t 2> timing
ls
note: -t flag tells the script to output all timing info to standard error, so later we call scriptreplay, feeding it the timing file. take note of that replaying a session is only guaranteed to work properly on the terminal where the oriiginal session output file was created.

for realtime monitoring on another tty
mkfifo out
script -f out (waiting for another person to do 'cat out' in another ssh session, then it will promopt command line promot to continue)

then use

Tuesday, October 23, 2007

nohup and disown

1. nohup command >/dev/null &
nohup command > filename &
kill -9 number

2. command
disown

command
disown -h jobnumber
%job-number

command
disown -ar

Thursday, October 11, 2007

read and display each line of a file

1. command line
while read line ;do echo $line ;done < /etc/hosts

2. script
[db2inst1@vapp1-1 resetocbc]$ more /tmp/i.sh
while read line
do
echo $line
done < /etc/hosts

Saturday, October 6, 2007