PDA

توجه ! این یک نسخه آرشیو شده می باشد و در این حالت شما عکسی را مشاهده نمی کنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : زمانبدی کارها در لینوکس Cron Job



TAHA
05-29-2012, 11:28 PM
New Page 1Cron job (G 4E' 'JF 'EC'F 1' EJ /G/ CG (1.J '2 C'1G'J E/J1J*J H( 3'J**'F 1' (5H1* .H/C'1 (1F'EG 1J2J FE'&J/ *' C'1G'JJ CG (' JC /H1G 2E'FJ E9JF ('J/ 1HJ H( 3'J* 4E' ',1' 4H/ H 4E' EJ ('J3* /1 G1 ('1 'JF C'1 1' (5H1* /3*J 'F,'E /GJ/ (5H1* '*HE'*JC (1F'EG 1J2J CF/ . E+D' 4E' EJ .H'GJ/ /1 G1 GA*G temporary files .H/ 1' ~'C CFJ/ *' A6'J H( 4E' '4:'D F4H/ Cron job EJ *H'F/ (5H1* '*HE'*JC 'JF C'1G' 1' (1'J 4E' 'F,'E /G/ (/HF 'JFCG FJ'2J (G 1,H9 4E' (G 3J3*E E/J1J* EJ2('FJ*'F ('4/.

/1 'JF B3E* /H FH9 1H4 (1'J E/J1J* Cron jobs H,H/ /'1/:


Standard

*GJG C1/F JC range '2 3* G'JJ CG /'1'J E/* 2E'F ',1'JJ E4.5J /'1F/. 'JF 1H4 (3J'1 "3'F H 3'/G '3* H B'(DJ* 3A'14J /'1/.


(Advanced (Unix Style

*GJG C1/F JC (1F'EG EF8E (G -'D* Unix Style. 'JF B3E* (1'J C'1(1J CG EJ .H'G/ '2 'JF -'D* '3*A'/G CF/ B(D' "E'/G H 3A'14 /'/G 4/G '3*.

*H,G /'4*G ('44/ '2 'JF -'D* 2E'FJ EJ *H'FJ/ '3*A'/G CFJ& CG '7D'9'* C'AJ /1 2EJFG C'1 (' Linux /'4*G ('4J/.


/3*H1 2('F Crontab
A'ÌD crontab 44 field (AÌD/) E9ÌF (G *1*Ì( /BÌBG 3'9* 1H2 E'G (ñ *' óñ) E'G 1H2 GA*G (ð *' ö) H /3*H1Ì(/3*H1'*Ì) ©G ('Ì/ ',1' 4HF/. /1 2Ì1 A1E ©DÌ 'ÌF /3*H1 1' EÌ (ÌFÌ/:



* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)

E+'D G'Ì crontab
FH4*F A'ÌD crontab EE©F '3* (1'Ì 'HDÌF ('1 ©EÌ ¯Ì, ©FF/G (G F81 (13/. (F'(1'ÌF /1 2Ì1 *9/'/Ì E+'D (G GE1' *H6Ì- '1'&G 4/G '3*:



* * * * *
#G1 /BÌBG ',1' EÌ 4HF/ - Runs every minute

30 * * * *
#G1 óð /BÌBG ',1' EÌ 4HF/ - Runs at 30 minutes past the hour
45 6 * * *
#G1 1H2 3'9* ö:ôõ 5(- ',1' EÌ 4HF/ - Runs at 6:45 am every day
45 18 * * *
#G1 1H2 5(- 3'9* ö:ôõ (9/ '2 8G1 ',1' EÌ 4HF/ - Runs at 6:45 pm every day
00 1 * * 0
#G1 Ì©4F(G Ì'9* ñ 5(-(('E/'/) ',1' EÌ 4HF/ - Runs at 1:00 am every Sunday
00 1 * * 7
#G1 Ì©4F(G 3'9* ñ ('E/'/ ',1' EÌ 4HF/ - Runs at 1:00 am every Sunday
00 1 * * Sun
#G1 Ì©4F(G 3'9* ñ ('E/'/ ',1' EÌ 4HF/ - Runs at 1:00 am every Sunday
30 8 1 * *
#'HDÌF 1H2 G1 E'G 3'9* ø:óð - Runs at 8:30 am on the first day of every month
00 0-23/2 02 07 *
#Runs every other hour on the 2nd of July

9D'HG (1 E+'D G'Ì ('D' String G'Ì .'5Ì 1' EÌ *H'F (G ©'1 (1/:



@reboot #GF¯'E (H* 3Ì3*E ',1' EÌ 4H/ - Runs at boot
@yearly #G1 3'D ',1' EÌ 4H/ - Runs once a year [0 0 1 1 *]
@annually #G1 3'D ',1' EÌ 4H/ - Runs once a year [0 0 1 1 *]
@monthly #G1 E'G ',1' EÌ 4H/ - Runs once a month [0 0 1 * *]
@weekly #G1 GA*G ',1' EÌ 4H/ - Runs once a week [0 0 * * 0]
@daily #G1 1H2 ',1' EÌ 4H/ - Runs once a day [0 0 * * *]
@midnight #G1 1H2 ',1' EÌ 4H/ - Runs once a day [0 0 * * *]
@hourly #G1 3'9* ',1' EÌ 4H/ - Runs once an hour [0 * * * *]

',1'Ì †F/ÌF /3*H1
(1'Ì ',1'Ì †F/ÌF /3*H1 ~Ì /1~Ì "FG' 1' (' '3*A'/G '2 “&&” (G 5H1* ~Ì /1 ~Ì (FHÌ3Ì/. E+'D 2Ì1 '(*/' /3*H1 command_01 H 3~3 /3*H1 command_02 1' /1 G1 1H2 ',1' EÌ ©F/:


@daily &&

:Ì1 A9'D ©1/F '7D'9 13'FÌ '2 71ÌB 'ÌEÌD
(G 5H1* ~Ì4 A16 (1F'EG cron /1 GF¯'E '†1' ©1/F cronjob Ì© 'ÌEÌD '7D'9 13'FÌ (G ©'1(1 '13'D EÌ ©F/. /1 5H1*Ì ©G EÌ .H'GÌ/ 'ÌF 'E©'F 1' :Ì1 A9'D ©FÌ/ ©'AÌ3* .7 2Ì1 1' (G ".1 (1F'EG cron .H/ '6'AG ©FÌ/:


>/dev/null 2>&1

E4.5 ©1/F (© A'ÌD E.5H5 crontab (1'Ì '3*A'/G
GE'F7H1 ©G ~Ì4 *1 /1 ('D'Ì GEÌF E7D( 0©1 4/ 4E' EÌ *H'FÌ/ (' /3*H1 “crontab -e” Ì© A'ÌD crontab (3'2Ì/. (G G1 -'D EE©F '3* 4E' '2 B(D Ì© A'ÌD crontab /'4*G ('4Ì/. (1'Ì E4.5 ©1/F A'ÌD .H/ /3*H1 2Ì1 1' H'1/ ©FÌ/:


crontab -u

3~3 /3*H1 2Ì1 1' H'1/ ©FÌ/((G ,'Ì Tux F'E ©'1(1Ì .H/ 1' (FHÌ3Ì/):


crontab -u tux ~/crontab

A'ÌD crontab ©'1(1 tux (' F'E crontab /1 ~H4G .'F¯Ì "F 0.Ì1G 4/.
-0A ©1/F A'ÌD crontab
(1'Ì -0A A'ÌD crontab /3*H1 2Ì1 1' /1 *1EÌF'D H'1/ ©FÌ/:


crontab -r

'7D'9'* (Ì4*1
(1'Ì (/3* "H1/F '7D'9'* (Ì4*1 EÌ *H'FÌ/ A'ÌD manual E1(H7 (G crontab 1' (' '3*A'/G '2 /3*H1 2Ì1 /1 *1EÌF'D ((ÌF/:


man crontab