Linux/Unix 蝟餌絞 crontab 蝔撘舐其霈蝟餌絞雿輻刻芾閮剖券閬 嚗閬鈭
" u. A% z- `0 Z5 N1 P9 V
: ~0 k- [7 z: Q1 J靘憒雿輻刻臭誑閮剖瘥銝拐8暺芸ftp 唳啣餅瑼獢嚗 瘥憭拙憭3暺芸隞質蝑...閬摰鋆蝵殷閮園扯撣貉酉 /usr/sbin/crond 蝔撘銝 Linux 券璈芸頛伐憒潛曄 crond 刻嚗臭誑 /etc/rc.d/init.d/ 桅銝臬行撠瑁crond 蝔撘隞文仿璈芸瑁瑼鋆⊿U憒賣銵函內瘝摰鋆crond, CentOS 銝芾銝隞 8 r D8 }4 A$ M: X9 t
yum install vixie-cron 撠勗臬鋆摰
% D& C9 h5 a, @) G- h4 Y2 L( Y. |3 Z' l: T* c* s/ ?) G3 c
雿輻刻臭誑 crontab -e(摮瑼敺喳餌) 隞支蝺典神閬撌乩撖怠其 file 鋆∴瑁 crontab filename 撠勗臭誑鈭雿輻刻 crontab 瑼賣摮 /var/spool/cron/ 銝,瑼撠望航府撣唾摮,靘憒 root. }. z6 c( x7 a8 w* s
crontab 澆憒銝嚗
- T5 w1 } y0 E5 S% ]5 d
! E! b3 a$ w2 F6 C b7 y- @5 G 閬瑁隞
& K% k& `! F' m/ c靘憒:1 \& u. [2 n! V* f! }
9 {, ?" m* {; H! f0 g$ @: ^0 \
30 12 * * * /usr/bin/rm xxx.txt
- ?9 U3 \- U1 y. l. [) [9 v9 z* P! l5 ~
12:30 撠 xxx.txt 瑼獢畾箸( E+ b7 p! l4 u- R; U: @1 v
* 銵函內瘥交瘥賢瑁
" R( _6 B0 e7 t8 D血撖 crontab 瘜冽敹雿輻 蝯撠頝臬憒 rm 瑁瑼 敹撖急 /usr/bin/rm
+ `0 A2 g* N/ o3 z6 p靘:# every two hours at the top of the hour7 P4 |4 n4 }) B7 Q6 F: d
0 */2 * * * date
) j; |' X- h( | # every two hours from 11p.m. to 7a.m., and at 8a.m.
; {; ]: U: C) g6 C0 E4 {) T8 k. w4 R 0 23-7/2,8 * * * date
3 S4 f) ^& ?2 j _& V6 ~
; }( O* k# L: T渲底蝝啣臬: http://linux.vbird.org/linux_basic/0430cron.php& [$ C: g/ [- Z" S- I
% S( |% m) s! c7 K. Q/ X
3 r6 Z3 D/ s p/ o. d% c0 P
5 ~6 i# `$ m9 ?" P v
) q' q/ W! @, L; R# K1 J# t5 [) l |
|