102-500 · Question #115
Given the following user's crontab entry: 15 14 1-5 /usr/local/bin/example.sh When will the script /usr/local/bin/example.sh be executed?
The correct answer is E. At 14:15 local time, Monday to Friday. Crontab format: minute hour day-of-month month day-of-week command The five fields map to 15 14 1-5, meaning minute=15, hour=14, day-of-month=any (`), month=any (), day-of-week=1–5. In cron, day-of-week values 1–5 represent Monday through Friday, so the script runs at 14:15…
Question
Options
- AAt 14:15 local time, January till May.
- BAt 15:14 local time, 1st to 5th day of month.
- CAt 14:15 local time, February till June.
- DAt 14:15 local time, 1st to 5th day of month.
- EAt 14:15 local time, Monday to Friday
How the community answered
(46 responses)- A11% (5)
- B2% (1)
- C4% (2)
- D7% (3)
- E76% (35)
Explanation
Crontab format: minute hour day-of-month month day-of-week command
The five fields map to 15 14 * * 1-5, meaning minute=15, hour=14, day-of-month=any (*), month=any (*), day-of-week=1–5. In cron, day-of-week values 1–5 represent Monday through Friday, so the script runs at 14:15 (2:15 PM) local time on weekdays - making E correct.
Why the distractors fail:
- A & C misread the day-of-week field (
1-5) as a month range (January–May or February–June); months use a separate field (position 4), which is*here. - B & D misread
1-5as the day-of-month (position 3), which is also*here - and B additionally swaps the minute and hour values (15:14 instead of 14:15).
Memory tip: Memorize the field order with the phrase "M H D M W" - Minute, Hour, Day-of-month, Month, Weekday. When you see * * 1-5 at the end, the range is always in the weekday slot (0=Sunday, 1=Monday … 6=Saturday), never months or days of the month.
Topics
Community Discussion
No community discussion yet for this question.