Linux/Unix 蝟餌絞 crontab 蝔撘舐其霈蝟餌絞雿輻刻芾閮剖券閬 嚗閬鈭; L' z3 ^: `6 ]3 {" K8 F& ?5 w
3 H. ]& }( b/ {% j) l4 b靘憒雿輻刻臭誑閮剖瘥銝拐8暺芸ftp 唳啣餅瑼獢嚗 瘥憭拙憭3暺芸隞質蝑...閬摰鋆蝵殷閮園扯撣貉酉 /usr/sbin/crond 蝔撘銝 Linux 券璈芸頛伐憒潛曄 crond 刻嚗臭誑 /etc/rc.d/init.d/ 桅銝臬行撠瑁crond 蝔撘隞文仿璈芸瑁瑼鋆⊿U憒賣銵函內瘝摰鋆crond, CentOS 銝芾銝隞 & I, ^$ [0 h, ^* M# B
yum install vixie-cron 撠勗臬鋆摰
9 P! n/ |7 m6 `- z l& K# P4 l: ^& q' c
雿輻刻臭誑 crontab -e(摮瑼敺喳餌) 隞支蝺典神閬撌乩撖怠其 file 鋆∴瑁 crontab filename 撠勗臭誑鈭雿輻刻 crontab 瑼賣摮 /var/spool/cron/ 銝,瑼撠望航府撣唾摮,靘憒 root
& w b# U' U/ ^- m1 t' hcrontab 澆憒銝嚗
8 V# Z0 ^: t, s4 f. }9 R, C' h
% A$ H* `) v0 K; p 閬瑁隞
9 l, a6 |; i" ]% D4 W, j靘憒:
# Z9 r) F' v# p; y5 ^3 i
5 L3 M9 S' U% b5 l% h( l u# L30 12 * * * /usr/bin/rm xxx.txt
/ i; c( X* v$ e \3 z- Z3 p: w/ O0 K/ @) q
12:30 撠 xxx.txt 瑼獢畾箸4 {$ X7 q7 ~* V: j5 v; ]. |9 a
* 銵函內瘥交瘥賢瑁. H% ^) Q+ l( Y X
血撖 crontab 瘜冽敹雿輻 蝯撠頝臬憒 rm 瑁瑼 敹撖急 /usr/bin/rm
+ L; }4 O4 L) A3 R7 b( [$ W% ^/ m$ H- P靘:# every two hours at the top of the hour
A+ U. K( F, h: i 0 */2 * * * date
8 c K* `. z0 Z7 M* o; j3 d # every two hours from 11p.m. to 7a.m., and at 8a.m.
+ d# T& m* N8 I, V$ Z, G2 m 0 23-7/2,8 * * * date6 o2 B7 }" D( g8 C! P! b
; T" T: y, e- J, s3 _: h
渲底蝝啣臬: http://linux.vbird.org/linux_basic/0430cron.php
3 b6 R- g+ y1 p9 [# G
. r, G$ U- P( N3 E6 _; l
, ?4 L# p6 Z6 a* q: ?1 B0 E4 [
* H' r! |% H6 a. X& N; L
2 U* L/ y- t6 Q3 @& L* t# @: |* F/ B |
|