Setup keys for xxx to login yyy without password
[xxx-sync@xxx ~]$ ssh-keygen -t dsa
cp id_dsa.pub to xxx /home/xxx-sync/.ssh
Author Archives: yan
Find
To delete empty directory
for d in `find /www/xxxx/oldfiles/* -type d -mtime +1| sort -r`;do echo $d;rmdir $d;done
requiretty
Some cron didn’t work well after move to CentOS5
New to disable requiretty
May 19 10:40:01 xxx sudo: root : sorry, you must have a tty to run sudo ; TTY=unknown ; PWD=/www/xxx/bin ; USER=xxx ; COMMAND=/bin/sh moviepagechmod.sh
vi /etc/sudoers
#Defaults requiretty
Linux Command rpm
delete rpm packages ignoring dependent error
#rpm -e –nodeps openssl-0.9.7a-33.17
list all files installed by a package
rpm -ql package_name
LVM
Setup lvm
combine /dev/sdb and /dev/sdc
if there’s partition on /dev/sdb, /dev/sdc, need to clear them first using fdisk
fdisk /dev/sdb -> d (delete partition) ->w
fdisk /dev/sdc
pvcreate /dev/sdb
pvcreate /dev/sdc
vgcreate vgrp /dev/sdb /dev/sdc
vgchange -a y vg
vgdisplay vg|grep ‘Total PE
‘lvcreate -i2 -I8 -l 70006 vg -n lv
mkfs.ext3 /dev/vg/lv
tune2fs -r 128000 /dev/vg/lv
mount /dev/vg/lv /backup
Remove lvm
#lvremove /dev/vg/lv
#vgremove vg
#fdisk /dev/sdb
#mkfs.ext3 /dev/sdb1
#tune2fs -r 128000 /dev/sdb1
(do same to /dev/sdc)
#mount /dev/sdb1 /www
Logrotate
Some logrotate are not working properly
added “/var/log/xxx/*/errors” into /etc/logrotate.d/xxx
and change to weekly
/usr/local/zeus/web/log/errors /var/log/xxx/*/errors {
weekly
rotate 8
missingok
create 0644 nobody nobody
compress
}
problem in search
problem when search for “V&R”
V%26amp%3BR
%26 -> &
%3B -> ;
%26amp%3B -> &
Solution: change & to encoded code in query sent to html
Add:
$srch_name=eregi_replace(“&”,”%26amp%3B”,$srch_name);
before the following code
if($srch_name !=”){ $req.=”&name=$srch_name”; }
if($srch_site !=”){ $req.=”&site=$srch_site”; }
MySQL processlist
check mysql queries
mysqladmin processlist -v |less
Eat healthy
31 Simple Ways to Prevent Cancer: Reduce Your Risk
Consider this number: 10 million. That’s how many cases of cancer are diagnosed worldwide each year. Now consider this number: 15 million. That’s how many cases of cancer the World health Organization estimates will be diagnosed in the year 2020 — a 50 percent increase — if we don’t get our act together.
Most cancers don’t develop overnight or out of nowhere. Cancer is largely predictable, the end result of a decades-long process, but just a few simple changes in your daily life can significantly reduce your risk. Here are 31 great tips. Continue reading
missing ; before statement
To check Javascript error, use Firefox Web Developer Addon
Tool -> Error Console
Got javascript error as “missing ; before statement” although there was no missing “;”
Finally found the reason is that the javascript function used number at the beginning, like
2way_func = function(){ …..}