LX0-104 · Question #522
The correct crontab entry to execute the script chklog three times per month between 3 p.m. and 5 p.m.:
The correct answer is D. 0 15, 16, 17 1 * * chklog. The correct crontab entry for executing chklog at 3 PM, 4 PM, and 5 PM on the 1st day of every month is 0 15,16,17 1 chklog.
Question
Options
- A
- 3, 4, 5 1 * * chklog
- B3 3, 4, 5 1 * * chklog
- C3 15, 16, 17 * * * chklog
- D0 15, 16, 17 1 * * chklog
- E
- 15, 16, 17 1 * * chklog
How the community answered
(32 responses)- A13% (4)
- B3% (1)
- C6% (2)
- D75% (24)
- E3% (1)
Why each option
The correct crontab entry for executing `chklog` at 3 PM, 4 PM, and 5 PM on the 1st day of every month is `0 15,16,17 1 * * chklog`.
This entry runs every minute (`*`) at 3 AM, 4 AM, 5 AM (`3,4,5`), which is the wrong time and too frequent for minutes.
This entry runs at minute 3 (`3`) at 3 AM, 4 AM, 5 AM (`3,4,5`), which is the wrong time.
This entry runs at minute 3 (`3`) at 3 PM, 4 PM, 5 PM (`15,16,17`) every day of every month (`* * *`), not just on the 1st of the month.
The crontab syntax is `minute hour day_of_month month day_of_week command`. This entry specifies `0` for the minute (on the hour), `15,16,17` for hours (3 PM, 4 PM, 5 PM in 24-hour format), `1` for the day of the month (the 1st), and `*` for month and day of week (every month, every day of week, effectively constrained by the day of month).
This entry runs every minute (`*`) at 3 PM, 4 PM, 5 PM (`15,16,17`), which is too frequent for minutes, even if the hours and day of month are correct.
Concept tested: Crontab syntax and scheduling
Source: https://man7.org/linux/man-pages/man5/crontab.5.html
Topics
Community Discussion
No community discussion yet for this question.