[{"data":1,"prerenderedAt":575},["ShallowReactive",2],{"blog-cron-expression-syntax-for-beginners":3},{"id":4,"title":5,"body":6,"category":562,"date":563,"description":564,"extension":565,"meta":566,"navigation":567,"path":568,"readingTime":569,"seo":570,"stem":571,"tool":572,"updated":573,"__hash__":574},"blog\u002Fblog\u002Fcron-expression-syntax-for-beginners.md","Cron Expression Syntax for Beginners",{"type":7,"value":8,"toc":537},"minimark",[9,13,16,21,24,35,38,73,77,197,201,206,212,216,231,237,241,247,250,254,260,264,281,287,295,301,320,327,331,335,341,345,351,355,361,365,371,375,381,385,437,441,444,524,528],[10,11,12],"p",{},"Cron is the standard job scheduler on Unix and Linux systems. It runs commands on a schedule defined by a five-field expression. Whether you are scheduling database backups, log rotation, CI\u002FCD pipelines, or Kubernetes CronJobs, understanding cron syntax is an essential skill.",[10,14,15],{},"This guide teaches the five-field format from scratch with practical examples you can use today.",[17,18,20],"h2",{"id":19},"the-five-fields","The Five Fields",[10,22,23],{},"A cron expression has five fields separated by spaces:",[25,26,31],"pre",{"className":27,"code":29,"language":30},[28],"language-text","┌───────────── minute (0-59)\n│ ┌───────────── hour (0-23)\n│ │ ┌───────────── day of month (1-31)\n│ │ │ ┌───────────── month (1-12)\n│ │ │ │ ┌───────────── day of week (0-6, Sun=0)\n│ │ │ │ │\n* * * * *\n","text",[32,33,29],"code",{"__ignoreMap":34},"",[10,36,37],{},"Each field accepts:",[39,40,41,48,54,60,66],"ul",{},[42,43,44,45],"li",{},"A specific value: ",[32,46,47],{},"5",[42,49,50,51],{},"A wildcard (any value): ",[32,52,53],{},"*",[42,55,56,57],{},"A range: ",[32,58,59],{},"1-5",[42,61,62,63],{},"A list: ",[32,64,65],{},"1,3,5",[42,67,68,69,72],{},"A step: ",[32,70,71],{},"*\u002F15"," (every 15th value)",[17,74,76],{"id":75},"common-examples","Common Examples",[78,79,80,93],"table",{},[81,82,83],"thead",{},[84,85,86,90],"tr",{},[87,88,89],"th",{},"Expression",[87,91,92],{},"Schedule",[94,95,96,107,117,127,137,147,157,167,177,187],"tbody",{},[84,97,98,104],{},[99,100,101],"td",{},[32,102,103],{},"* * * * *",[99,105,106],{},"Every minute",[84,108,109,114],{},[99,110,111],{},[32,112,113],{},"0 * * * *",[99,115,116],{},"Every hour (at minute 0)",[84,118,119,124],{},[99,120,121],{},[32,122,123],{},"0 0 * * *",[99,125,126],{},"Daily at midnight",[84,128,129,134],{},[99,130,131],{},[32,132,133],{},"0 9 * * 1-5",[99,135,136],{},"Weekdays at 9:00 AM",[84,138,139,144],{},[99,140,141],{},[32,142,143],{},"0 0 1 * *",[99,145,146],{},"First of every month at midnight",[84,148,149,154],{},[99,150,151],{},[32,152,153],{},"*\u002F15 * * * *",[99,155,156],{},"Every 15 minutes",[84,158,159,164],{},[99,160,161],{},[32,162,163],{},"0 *\u002F6 * * *",[99,165,166],{},"Every 6 hours",[84,168,169,174],{},[99,170,171],{},[32,172,173],{},"30 2 * * 0",[99,175,176],{},"Sundays at 2:30 AM",[84,178,179,184],{},[99,180,181],{},[32,182,183],{},"0 9,17 * * *",[99,185,186],{},"At 9:00 AM and 5:00 PM daily",[84,188,189,194],{},[99,190,191],{},[32,192,193],{},"0 0 * * 1",[99,195,196],{},"Every Monday at midnight",[17,198,200],{"id":199},"field-details","Field Details",[202,203,205],"h3",{"id":204},"minute-0-59","Minute (0-59)",[25,207,210],{"className":208,"code":209,"language":30},[28],"0      → at the top of the hour\n30     → at half past\n*\u002F5    → every 5 minutes (0, 5, 10, 15, ...)\n5,35   → at minutes 5 and 35\n",[32,211,209],{"__ignoreMap":34},[202,213,215],{"id":214},"hour-0-23","Hour (0-23)",[10,217,218,219,222,223,226,227,230],{},"Uses 24-hour format. ",[32,220,221],{},"0"," is midnight, ",[32,224,225],{},"12"," is noon, ",[32,228,229],{},"23"," is 11 PM.",[25,232,235],{"className":233,"code":234,"language":30},[28],"9      → 9:00 AM\n*\u002F2    → every 2 hours (0, 2, 4, 6, ...)\n9-17   → every hour from 9 AM to 5 PM\n",[32,236,234],{"__ignoreMap":34},[202,238,240],{"id":239},"day-of-month-1-31","Day of Month (1-31)",[25,242,245],{"className":243,"code":244,"language":30},[28],"1      → first of the month\n15     → fifteenth\n1,15   → first and fifteenth\n",[32,246,244],{"__ignoreMap":34},[10,248,249],{},"Not all months have 31 days. If you schedule day 31, the job skips months with fewer days.",[202,251,253],{"id":252},"month-1-12","Month (1-12)",[25,255,258],{"className":256,"code":257,"language":30},[28],"1      → January\n6      → June\n1-3    → January through March\n*\u002F3    → every 3 months (Jan, Apr, Jul, Oct)\n",[32,259,257],{"__ignoreMap":34},[202,261,263],{"id":262},"day-of-week-0-6","Day of Week (0-6)",[10,265,266,268,269,272,273,276,277,280],{},[32,267,221],{}," and ",[32,270,271],{},"7"," both mean Sunday. ",[32,274,275],{},"1"," = Monday through ",[32,278,279],{},"6"," = Saturday.",[25,282,285],{"className":283,"code":284,"language":30},[28],"0      → Sunday\n1-5    → Monday through Friday (weekdays)\n6,0    → weekends\n",[32,286,284],{"__ignoreMap":34},[17,288,290,291,294],{"id":289},"step-syntax-n","Step Syntax (",[32,292,293],{},"*\u002Fn",")",[10,296,297,298,300],{},"The step syntax ",[32,299,293],{}," means \"every nth value starting from the field minimum\":",[39,302,303,308,314],{},[42,304,305,307],{},[32,306,71],{}," in the minute field → 0, 15, 30, 45",[42,309,310,313],{},[32,311,312],{},"*\u002F6"," in the hour field → 0, 6, 12, 18",[42,315,316,319],{},[32,317,318],{},"*\u002F2"," in the day-of-week field → 0, 2, 4, 6",[10,321,322,323,326],{},"You can combine steps with ranges: ",[32,324,325],{},"1-30\u002F5"," means every 5th value from 1 to 30 (1, 6, 11, 16, 21, 26).",[17,328,330],{"id":329},"real-world-examples","Real-World Examples",[202,332,334],{"id":333},"database-backup-every-night-at-2-am","Database backup every night at 2 AM",[25,336,339],{"className":337,"code":338,"language":30},[28],"0 2 * * *\n",[32,340,338],{"__ignoreMap":34},[202,342,344],{"id":343},"log-rotation-every-sunday-at-330-am","Log rotation every Sunday at 3:30 AM",[25,346,349],{"className":347,"code":348,"language":30},[28],"30 3 * * 0\n",[32,350,348],{"__ignoreMap":34},[202,352,354],{"id":353},"health-check-every-5-minutes-during-business-hours","Health check every 5 minutes during business hours",[25,356,359],{"className":357,"code":358,"language":30},[28],"*\u002F5 9-17 * * 1-5\n",[32,360,358],{"__ignoreMap":34},[202,362,364],{"id":363},"monthly-report-on-the-1st-at-8-am","Monthly report on the 1st at 8 AM",[25,366,369],{"className":367,"code":368,"language":30},[28],"0 8 1 * *\n",[32,370,368],{"__ignoreMap":34},[202,372,374],{"id":373},"deploy-to-staging-every-weekday-at-6-pm","Deploy to staging every weekday at 6 PM",[25,376,379],{"className":377,"code":378,"language":30},[28],"0 18 * * 1-5\n",[32,380,378],{"__ignoreMap":34},[17,382,384],{"id":383},"common-mistakes","Common Mistakes",[386,387,388,400,406,416,428],"ol",{},[42,389,390,394,395,399],{},[391,392,393],"strong",{},"Confusing day-of-month and day-of-week"," — if both are set to non-wildcard values, most cron implementations run when ",[396,397,398],"em",{},"either"," matches (OR logic), not when both match (AND logic). This catches many people.",[42,401,402,405],{},[391,403,404],{},"Timezone confusion"," — system cron uses the server's timezone. Kubernetes CronJobs default to UTC. Always specify which timezone your schedule targets.",[42,407,408,411,412,415],{},[391,409,410],{},"Running at boot, not by schedule"," — ",[32,413,414],{},"@reboot"," is a special string, not a cron expression. It runs once when the cron daemon starts.",[42,417,418,411,424,427],{},[391,419,420,421,423],{},"Forgetting that ",[32,422,293],{}," starts at 0",[32,425,426],{},"*\u002F10"," in the hour field runs at 0:00, 10:00, 20:00 — not at the current time plus 10 hours.",[42,429,430,433,434],{},[391,431,432],{},"Output accumulation"," — cron emails stdout and stderr to the user. Redirect output to avoid filling the mailbox: ",[32,435,436],{},"0 * * * * \u002Fpath\u002Fto\u002Fscript > \u002Fdev\u002Fnull 2>&1",[17,438,440],{"id":439},"special-strings","Special Strings",[10,442,443],{},"Most cron implementations support these shortcuts:",[78,445,446,456],{},[81,447,448],{},[84,449,450,453],{},[87,451,452],{},"String",[87,454,455],{},"Equivalent",[94,457,458,470,481,493,504,515],{},[84,459,460,465],{},[99,461,462],{},[32,463,464],{},"@yearly",[99,466,467],{},[32,468,469],{},"0 0 1 1 *",[84,471,472,477],{},[99,473,474],{},[32,475,476],{},"@monthly",[99,478,479],{},[32,480,143],{},[84,482,483,488],{},[99,484,485],{},[32,486,487],{},"@weekly",[99,489,490],{},[32,491,492],{},"0 0 * * 0",[84,494,495,500],{},[99,496,497],{},[32,498,499],{},"@daily",[99,501,502],{},[32,503,123],{},[84,505,506,511],{},[99,507,508],{},[32,509,510],{},"@hourly",[99,512,513],{},[32,514,113],{},[84,516,517,521],{},[99,518,519],{},[32,520,414],{},[99,522,523],{},"Run once at startup",[17,525,527],{"id":526},"try-it","Try It",[10,529,530,531,536],{},"Build and validate cron expressions interactively with ",[532,533,535],"a",{"href":534},"\u002Ftools\u002Fcron-builder","StackCache Cron Schedule Builder",". It shows the next execution times and translates expressions into plain English — all in your browser with no account needed.",{"title":34,"searchDepth":538,"depth":538,"links":539},2,[540,541,542,550,552,559,560,561],{"id":19,"depth":538,"text":20},{"id":75,"depth":538,"text":76},{"id":199,"depth":538,"text":200,"children":543},[544,546,547,548,549],{"id":204,"depth":545,"text":205},3,{"id":214,"depth":545,"text":215},{"id":239,"depth":545,"text":240},{"id":252,"depth":545,"text":253},{"id":262,"depth":545,"text":263},{"id":289,"depth":538,"text":551},"Step Syntax (*\u002Fn)",{"id":329,"depth":538,"text":330,"children":553},[554,555,556,557,558],{"id":333,"depth":545,"text":334},{"id":343,"depth":545,"text":344},{"id":353,"depth":545,"text":354},{"id":363,"depth":545,"text":364},{"id":373,"depth":545,"text":374},{"id":383,"depth":538,"text":384},{"id":439,"depth":538,"text":440},{"id":526,"depth":538,"text":527},"Guides","2026-09-08","Learn the five-field Unix cron expression format with practical examples. Covers minutes, hours, days, months, weekdays, and common scheduling patterns.","md",{},true,"\u002Fblog\u002Fcron-expression-syntax-for-beginners",6,{"title":5,"description":564},"blog\u002Fcron-expression-syntax-for-beginners","cron-builder",null,"KxhoNyTFaunqdcAL5A9Of43C0VGfnKMmb9tI-g2ukZw",1788868139328]