Linux/Unix 蝟餌絞 crontab 蝔撘舐其霈蝟餌絞雿輻刻芾閮剖券閬 嚗閬鈭
1 s2 W A# o% O& x6 H! q q* ] h- @9 S( X6 d' t7 T
靘憒雿輻刻臭誑閮剖瘥銝拐8暺芸ftp 唳啣餅瑼獢嚗 瘥憭拙憭3暺芸隞質蝑...閬摰鋆蝵殷閮園扯撣貉酉 /usr/sbin/crond 蝔撘銝 Linux 券璈芸頛伐憒潛曄 crond 刻嚗臭誑 /etc/rc.d/init.d/ 桅銝臬行撠瑁crond 蝔撘隞文仿璈芸瑁瑼鋆⊿U憒賣銵函內瘝摰鋆crond, CentOS 銝芾銝隞 5 _, j2 L8 P- A+ ]/ L }+ Y
yum install vixie-cron 撠勗臬鋆摰
6 c- |- V$ v. f) F' j3 F0 X2 d7 C" U {6 v3 K
雿輻刻臭誑 crontab -e(摮瑼敺喳餌) 隞支蝺典神閬撌乩撖怠其 file 鋆∴瑁 crontab filename 撠勗臭誑鈭雿輻刻 crontab 瑼賣摮 /var/spool/cron/ 銝,瑼撠望航府撣唾摮,靘憒 root: ]6 g& n. h7 N$ \
crontab 澆憒銝嚗* z* j1 }7 p: G$ c1 M! G( h1 _( W
; Q% g# a, c! C: u) ^6 P2 Y, t
閬瑁隞
7 c# a! D0 z e$ |: H9 S靘憒:: A6 Q' x8 W7 F1 p( k' W
# m; e [9 E+ J- C( h
30 12 * * * /usr/bin/rm xxx.txt
* B$ ~, Q2 O/ [# A! |3 Q& y# e( B& O$ B) }! _; M" |. B
12:30 撠 xxx.txt 瑼獢畾箸
( n# h9 @$ ` x* 銵函內瘥交瘥賢瑁% e% Y" c& X7 G6 C6 Z) t
血撖 crontab 瘜冽敹雿輻 蝯撠頝臬憒 rm 瑁瑼 敹撖急 /usr/bin/rm" L) h0 |: X) m: J( g8 z. O+ p
靘:# every two hours at the top of the hour# o2 I" _2 b3 j F' g3 V
0 */2 * * * date
' M# T% t, S$ l4 l9 N, a # every two hours from 11p.m. to 7a.m., and at 8a.m.
. [8 o) C% n8 E2 z; W) P5 b 0 23-7/2,8 * * * date
+ c9 }% H# {6 C% n7 q4 Z0 I. b( J' v; e/ A8 z
渲底蝝啣臬: http://linux.vbird.org/linux_basic/0430cron.php
7 o. z- D' z# d. f6 _3 x( r; V" n4 b, A w* E: X' @, s7 |0 d8 R
" x) H) c$ Z0 l, |
, F8 s; z! S! N2 ], [* x8 I! X
; k) w$ k9 f- g/ Q1 C |
|