Notes: February 2007 Archives

Run cron jobs at last day of the month

| | Comments (0)

for Linux
0 8 28-31 * * [ `date -d tomorrow +\%e` -eq 1 ] && do-something

for other Unix,BSD
0 8 28-31 * * [ `echo \`cal\` | awk '{print $NF}'` -eq 1 ] && do-something

More, run cron jobs at last workday of the month
0 8 26-31 * * root [ `echo \`cal | cut -d' ' -f2-6\` | awk '{print $NF}'` -eq `date +%e` ] && do-something

ref. 系统管理員工具包: 時間和事件管理

MySQL OPTIMIZE TABLE

| | Comments (0)

MySQL 在刪除資料時, 並不會釋放出磁碟空間,
當刪除很多資料時, 可以用 OPTIMIZE TABLE 來把資料 defrag 一下, 並且會釋放出磁碟空間.
OPTIMIZE TABLE tbl_name

Bind up/down arrow key to BASH history-search

| | Comments (0)

在 ~/.bashrc 或 /etc/bashrc 加入以下兩行
bind '"\x1b\x5b\x41":history-search-backward'
bind '"\x1b\x5b\x42":history-search-forward'
這樣就可以鍵入 command prefix + 上下鍵做 history search, 很方便.
感謝 zxvc 提供
ref. [心得] 好用的bash history function

Pages

March 2008

Sun Mon Tue Wed Thu Fri Sat
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          

About this Archive

This page is a archive of entries in the Notes category from February 2007.

Notes: January 2007 is the previous archive.

Notes: March 2007 is the next archive.

Find recent content on the main index or look in the archives to find all content.