元宵燈謎

今日是元宵街節,就試試送這首燈謎詩給愛人估吧!

青山寺上一叢竹,
天鵝雖在鳥已飛。
前塵往事已過去,
白雲心中有彩虹,
心中有情藏不住。
雨水滴滴會有情,
終久到頭沒感情。
(每句話猜一個字)

Highlight 後便可顯示答案:
青山寺上一叢竹 —— 等(寺+竹)
天鵝雖在鳥已飛 —— 我(鵝-鳥)
站在樹上看遠方 —— 親(立+木)
白雲心中有彩虹 —— 自(白+一)
心中有情藏不住 —— 說(藏不住就說出來,這個編得不好)
雨水滴滴會有情 —— 愛(爫+友,編差了點,少了個冖)
終久到頭沒感情 —— 你(您-心)

數學問題一則

一日,有個年輕人去童鞋店里買了對波鞋。這對鞋子成本是15元,標價是21元。结果是這個年輕人掏出50元要買這鞋子。鞋店當時沒有散錢,後來用那年輕人付的50元向街坊换了50元的散錢,找给年輕人29元。但是街坊後來發現那50 元是假鈔,鞋店無奈之下,還了街坊50元。 現在問題是:鞋店在這次交易中到底損失了多少錢 ?

Highlight 後便可顯示答案:
44

Spec thx: 珍珍

Dialy Backup Task

I would like to share some experience on daily backup task even though I'm not a Linux expert.

Noticed below user group created.
someonex:500:
apache:x:48:
mysql:x:27:
webmaster:x:501:
fred:x:502:

Suggest to create a backup group with a dedicated user for backing up db & web src.
 
A sample db backup script is available at /home/fred/backup_db.sh
The last command (I coded all tables) in script is commended out for Fred to inform all of us which table should be backup.
=============================================
aDate=`date +%Y%m%d`
filename="bkup""$aDate"
echo "Creating daily backup <"$aDate"/"$filename">"
#mysqldump –add-drop-table –allow-keywords -q -a -c -u username -ppassword –all-databases > $filename.sql =============================================

A sample cron job is setup to run the backup scripts. (Please note that the cron job is exec under the user home, so the cron jobs has to be set under the new user instead of Fred/root)
e.g. every day 18:30
=============================================
[fred@panda ~]$ crontab -l
30     18     *     *     *         ./backup_db.sh > backup.log
=============================================

Belows stated fyr to edit the cron job. 
crontab -e     Edit your crontab file, or create one if it doesn't already exist.
crontab -l      Display your crontab file.
crontab -r      Remove your crontab file.
crontab -v      Display the last time you edited your crontab file. (This option is only available on a few systems.)

If www scripts are expected to create daily backup, similar scripts should be setup.
** The scripts should be coded in a better manner to spool a log instead of redirecting from cron job 😀

Common Linux Command

Common Linux command for server administration.

1. top
performance monitor, CPU, memory usage, paging…etc

2. ps -ef
list out all process which is running

3. grep
a find unitility
mix with ps, list out the processes launched by this user
e.g. ps -ef | grep [user name]

4. kill
purge process
e.g. if httpd is hang up and normal shutdown of web server / db failed,
with 2 & 3, obtain the process ID
then kill the process manually.
e.g.
[root@mylinux root]# ps -ef | grep nobody
root     18970 18264  0 09:24 pts/0    00:00:00 grep nobody
[root@mylinux root]# kill -9 18970
Remark: -9 means force kill

5. vnc
Linux build in vnc server support, in console, use
$vncserver [session id]
to start a session
e.g. vncserver :1
after using, type $vncserver -kill [session id] to terminate the remote desktop
e.g. vncserver -kill :1