Linux/Unix 蝟餌絞 crontab 蝔撘舐其霈蝟餌絞雿輻刻芾閮剖券閬 嚗閬鈭
% p( j, Q3 |9 U+ e; u% m* G
( f: L7 D. I0 a" x$ y靘憒雿輻刻臭誑閮剖瘥銝拐8暺芸ftp 唳啣餅瑼獢嚗 瘥憭拙憭3暺芸隞質蝑...閬摰鋆蝵殷閮園扯撣貉酉 /usr/sbin/crond 蝔撘銝 Linux 券璈芸頛伐憒潛曄 crond 刻嚗臭誑 /etc/rc.d/init.d/ 桅銝臬行撠瑁crond 蝔撘隞文仿璈芸瑁瑼鋆⊿U憒賣銵函內瘝摰鋆crond, CentOS 銝芾銝隞 5 z" h. B7 W# ^ x+ o8 ^7 z ^4 N
yum install vixie-cron 撠勗臬鋆摰
' Q5 t- ~' g- X8 X E7 c, Q7 l/ _ n
雿輻刻臭誑 crontab -e(摮瑼敺喳餌) 隞支蝺典神閬撌乩撖怠其 file 鋆∴瑁 crontab filename 撠勗臭誑鈭雿輻刻 crontab 瑼賣摮 /var/spool/cron/ 銝,瑼撠望航府撣唾摮,靘憒 root
0 U) l3 H# f1 a. q4 ]crontab 澆憒銝嚗
3 I5 g& `' u! T2 A. L8 E. N
8 P1 f2 C" `" }7 T- b 閬瑁隞
% y& s2 @2 v5 o6 a6 o+ c! M靘憒:
# q% m9 S, X3 T) I& [( D1 f" R- v7 |; ~
30 12 * * * /usr/bin/rm xxx.txt+ o6 k6 r E2 H+ P& W3 n! _
- z1 p+ C0 d* s9 q- f 12:30 撠 xxx.txt 瑼獢畾箸
9 }+ R: M* N% X; m; B* 銵函內瘥交瘥賢瑁6 e2 n+ M8 O; s" I8 l; v/ i, s! T
血撖 crontab 瘜冽敹雿輻 蝯撠頝臬憒 rm 瑁瑼 敹撖急 /usr/bin/rm
" b; e& Y% w& H n' {靘:# every two hours at the top of the hour
2 D. G; T7 P k* j: r 0 */2 * * * date
0 G1 I+ |" `, c0 H # every two hours from 11p.m. to 7a.m., and at 8a.m.- _$ ~2 q" V T+ f
0 23-7/2,8 * * * date r' Q! V8 y( \2 [- U% v
: Z5 Q( L* k: N5 d渲底蝝啣臬: http://linux.vbird.org/linux_basic/0430cron.php( O: i& C5 _6 i9 m
# _- F$ f& K0 W5 {! U2 B7 g
8 U# A' f) i/ h g2 n4 f* ^
" w/ Q k! o5 E( |. s* B5 \
$ @8 }. F- ]3 P8 v2 Q5 N' x! c |
|