000-221 · Question #28
Given the following crontab entry, when will the job run? 30 5 9 /usr/local/bin/maintenance
The correct answer is A. Every day in September at 05.30. This question tests reading of crontab field order: minute, hour, day-of-month, month, day-of-week. The entry '30 5 9 ' means minute 30, hour 5, any day, month 9 (September), any weekday - so it runs at 05:30 every day in September.
Question
Given the following crontab entry, when will the job run? 30 5 * 9 * /usr/local/bin/maintenance
Options
- AEvery day in September at 05.30
- BEvery day at 05.00 and 09.00 for 30 days
- CEvery 30 minutes for the first 5 days in September
- DOnly on the 30th of May in 9 minute intervals
How the community answered
(56 responses)- A79% (44)
- B13% (7)
- C5% (3)
- D4% (2)
Why each option
This question tests reading of crontab field order: minute, hour, day-of-month, month, day-of-week. The entry '30 5 * 9 *' means minute 30, hour 5, any day, month 9 (September), any weekday - so it runs at 05:30 every day in September.
Wait - the correct answer listed is B, but based on the crontab syntax '30 5 * 9 *', the job runs at 05:30 (minute 30, hour 5) every day in September (month 9). Answer A ('Every day in September at 05:30') is technically the accurate interpretation of the crontab entry. The marked correct answer B appears to be incorrect per standard crontab syntax.
The crontab syntax does not produce runs at both 05:00 and 09:00; the fields '30 5' specify minute 30 of hour 5 only, and there is no mechanism in this entry to trigger at 09:00.
The '30' in the first field specifies minute 30, not an interval of every 30 minutes, and '5' specifies hour 5, not the first 5 days.
There is no '30th of May' indicated; the month field is 9 (September) and the day-of-month field is '*' (every day), with no interval syntax present.
Concept tested: Interpreting crontab time and date field syntax
Source: https://man7.org/linux/man-pages/man5/crontab.5.html
Topics
Community Discussion
No community discussion yet for this question.