Linux/Unix 蝟餌絞 crontab 蝔撘舐其霈蝟餌絞雿輻刻芾閮剖券閬 嚗閬鈭4 Q/ o7 p5 `# O. i) N& n/ R1 R7 [
& {( v- z! ?9 H6 N! ]1 a9 [靘憒雿輻刻臭誑閮剖瘥銝拐8暺芸ftp 唳啣餅瑼獢嚗 瘥憭拙憭3暺芸隞質蝑...閬摰鋆蝵殷閮園扯撣貉酉 /usr/sbin/crond 蝔撘銝 Linux 券璈芸頛伐憒潛曄 crond 刻嚗臭誑 /etc/rc.d/init.d/ 桅銝臬行撠瑁crond 蝔撘隞文仿璈芸瑁瑼鋆⊿U憒賣銵函內瘝摰鋆crond, CentOS 銝芾銝隞 5 z- F0 y% s% b6 k
yum install vixie-cron 撠勗臬鋆摰
' S' f3 q4 m5 f1 ]: J& e6 r0 @( S7 v0 I0 f1 G. `7 M
雿輻刻臭誑 crontab -e(摮瑼敺喳餌) 隞支蝺典神閬撌乩撖怠其 file 鋆∴瑁 crontab filename 撠勗臭誑鈭雿輻刻 crontab 瑼賣摮 /var/spool/cron/ 銝,瑼撠望航府撣唾摮,靘憒 root- X8 l R2 l* c
crontab 澆憒銝嚗5 ^0 R# c* y. g* a y
6 c; O; C5 w3 V- R8 {0 c6 m 閬瑁隞6 ?# |/ H/ f+ k3 m2 ]: v; M+ J
靘憒:
+ E: L5 r: V S, ?2 f' H6 N" _6 O% S4 i' c
30 12 * * * /usr/bin/rm xxx.txt
+ f- V) [/ ^$ O" j
R0 _5 ]% |* w" Y 12:30 撠 xxx.txt 瑼獢畾箸! d3 }% i( b9 T R! F# @$ j
* 銵函內瘥交瘥賢瑁
7 K' o& k2 k7 T血撖 crontab 瘜冽敹雿輻 蝯撠頝臬憒 rm 瑁瑼 敹撖急 /usr/bin/rm
; n( `( Z! C8 x9 t靘:# every two hours at the top of the hour
( f- D1 a6 w# \+ Y7 }$ p 0 */2 * * * date4 \: A0 p) @$ O: K
# every two hours from 11p.m. to 7a.m., and at 8a.m.
, R& N) c7 z+ ?* u 0 23-7/2,8 * * * date( ~: I8 M7 g( }, w5 K) T3 E
" u ~9 H' H i! c( M0 M渲底蝝啣臬: http://linux.vbird.org/linux_basic/0430cron.php
* m: f5 L" u. P% ]3 N
2 d; \# i0 O% {* D) j* O1 j3 w4 R3 T" i% M) l8 J. l( V/ W9 t
1 P( q& V3 i; P1 a) }
. G) G' F- j( S: }9 m" U5 \. @/ ~ |
|