Amfani Crontab akan CentOS: Jagorar Mataki-by-Taki

Crontab kayan aiki ne akan CentOS tsarin aiki wanda ke ba ku damar tsara ayyuka masu maimaitawa a ƙayyadadden lokaci. Anan akwai umarnin don amfani crontab akan CentOS:

Mataki 1: Buɗe crontab don mai amfani na yanzu

Don buɗewa crontab ga mai amfani na yanzu, gudanar da umarni mai zuwa:

crontab -e

Mataki na 2: Fahimtar crontab haɗin kai

Kowane layi a cikin crontab yana wakiltar takamaiman aikin da aka tsara.

Maganar crontab ita ce kamar haka:

* * * * * command_to_be_executed  
-- -- -  
|| || |  
|| || ----- Day of the week(0- 7)(Sunday is 0 and 7)  
|| | ------- Month(1- 12)  
|| --------- Day of the month(1- 31)  
| ----------- Hour(0- 23)  
------------- Minute(0- 59)  

Alamar alama(*) tana nufin duk ƙimar ƙimar wannan filin.

Mataki 3: Ƙayyade ayyuka a cikin crontab

Misali, don gudanar da rubutun mai suna "myscript.sh" a 1 AM kowace rana, ƙara layin mai zuwa zuwa crontab:

0 1 * * * /path/to/myscript.sh

Mataki 4: Ajiye kuma fita

Bayan ƙara ayyuka zuwa crontab, ajiye kuma fita ta latsawa Ctrl + X, sannan ka buga Y kuma latsa Enter.

Mataki na 5: Duba crontab

Don duba jerin ayyuka a cikin crontab, gudanar da umarni mai zuwa:

crontab -l

Mataki na 6: Cire wani aiki daga crontab

o cire aiki daga crontab, gudanar da umarni mai zuwa:

crontab -r

Lura: Yi hankali lokacin amfani crontab, tabbatar da daidaitawa da lokacin tsarawa daidai ne don guje wa lalacewar tsarin ko kitsewa.