Skip to main content

cron

FormatFormato

Min  Hour Day  Mon  Weekday
┬    ┬    ┬    ┬    ┬
│    │    │    │    └─  DayDía ofde Weekla semana (0=SunDom .. 6=Sat)Sáb)
│    │    │    └──────  MonthMes         (1..12)
│    │    └───────────  DayDía ofdel Monthmes (1..31)
│    └────────────────  HourHora        (0..23)
└─────────────────────  MinuteMinuto      (0..59)
FieldCampo RangeRango SpecialCaracteres charactersespeciales
MinuteMinuto 0-59 , - * /
HourHora 0-23 , - * /
DayDía ofdel Monthmes 1-31 , - * ? / L W
MonthMes 1-12 , - * /
DayDía ofde Weekla semana 0-6 , - * ? / L #

ExamplesEjemplos

FormatFormato ResultResultado
*/15 * * * * EveryCada 15 minsminutos
0 * * * * EveryCada hourhora
0 */2 * * * EveryCada 2 hourshoras
15 2 * * * AtA las 2:15AM ofde everycada daydía
15 2 * * ? AtA las 2:15AM ofde everycada daydía
10 9 * * 5 AtA las 9:10AM ofde everycada Fridayviernes
0 0 * * 0 AtA midnightmedia ofnoche everyde Sundaycada domingo
15 2 * * 1L AtA las 2:15am ondel theúltimo lastlunes mondayde ofcada every monthmes
15 0 * * 4#2 AtA las 00:15am ondel thesegundo secondmartes thursdayde ofcada every monthmes
0 0 1 * * EveryCada 1stprimero ofde monthmes (monthly)mensualmente)
0 0 1 1 * EveryCada 1stprimero ofde januaryenero (yearly)anualmente)
@reboot EveryCada rebootreinicio (non-standard)no estándar)

SpecialCadenas stringsespeciales

FormatFormato ResultResultado
@reboot RunSe once,ejecuta atuna systemvez, startupal arranque del sistema (non-standard)no estándar)
@yearly RunSe onceejecuta everyuna year,vez cada año, "0 0 1 1 *" (non-standard)no estándar)
@annually (samelo asmismo @yearly)que @yearly) (non-standard)no estándar)
@monthly RunSe onceejecuta everyuna month,vez cada mes, "0 0 1 * *" (non-standard)no estándar)
@weekly RunSe onceejecuta everyuna week,vez cada semana, "0 0 * * 0" (non-standard)no estándar)
@daily RunSe onceejecuta eachuna day,vez cada día "0 0 * * *" (non-standard)no estándar)
@midnight (samelo asmismo que @daily) (non-standard)no estándar)
@hourly RunSe onceejecuta anuna hour,vez cada hora, "0 * * * *" (non-standard)no estándar)

CrontabComando commandcrontab

CommandComando ResultResultado
crontab -e EditEdita oro createcrea aun fichero crontab file ifsi doesn’tno already exist.existe.
crontab -l DisplayMuestra theel crontabfichero file.crontab.
crontab -r RemoveElimina theel crontabfichero file.crontab.
crontab -v DisplayMuestra thela lastúltima timevez youque editededitaste yourtu crontabfichero file.crontab. (non-standard)no estándar)

SpecialCaracteres charactersespeciales

CharacterCarácter ObservationsObservaciones
Asterik(Asterico (*) MatchesCoincide allcon valuestodos inlos thevalores fielddel orcampo anyo possiblecualquier value.valor posible.
Hyphen(Guión (-) UsedSe tousa definepara adefinir range.Ex:un rango. P.ej.: 1-5 inen 5thel field(Day Ofcampo Week)(día Everyde Weekdayla i.e.,semana) Mondaycada tosemana Fridayde lunes a viernes.
SlashBarra (/) 1st1er field(Minute)campo (minuto) /15 meaningsignifica everycada fifteenquince minuteminutos oro incrementincrementos ofdel range.rango.
CommaComa (,) UsedSe tousa separatepara items.Ex:separar elementos. P.ej: 2,6,8 inen 2ndel fields(Hour) executescampo at(hora) se ejecuta a las 2am, 6am andy 8am8am.
L ItSólo isse allowedpuede onlyutilizar forpara Dayel ofcampo Monthdía ordel Daymes Ofo Weekdía field,de la semana, 2L inen Daydía ofde weekla indicatessemana Lastindica tuesdayel ofúltimo everymartes monthde cada mes.
HashAlmohadilla (#) ItSólo isse allowedpuede onlyutilizar forpara Dayel Ofcampo Weekdía field,de whichla mustsemana beque followedpuede withinseguir rangepor ofun rango de 1 toa 5. For example,P.ej: 4#1 meanssignifica "Theel firstprimer Thursday"martes" ofde givenun month.mes determinado.
Question markInterrogación (?) CanSe bepuede insteadutilizar ofen lugar de '*' andy allowedse forusa Daypara ofdia Monthdel andmes Dayy Ofdía Week.de Usagela issemana. restrictedEl touso eitherestá Dayrestringido ofal Monthdía ordel Daymes Ofo Weekdía inde ala cronsemana expression.en una expresión cron.

AlsoPara seemás información