XK0-005 · Question #655
A Linux administrator is configuring crontab and needs to schedule a task to run only on Saturday and Sunday at 9:00 a.m. every week of the year. Which of the following should the administrator use?
The correct answer is C. 0 9 * * 6,0 root /root/script.sh. Crontab fields are ordered: minute hour day-of-month month day-of-week. In cron, days of the week are numbered 0 (Sunday) through 6 (Saturday). The expression '0 9 6,0' means: at minute 0, hour 9, any day of month, any month, on Saturday (6) and Sunday (0). Option A uses '1-5'…
Question
A Linux administrator is configuring crontab and needs to schedule a task to run only on Saturday and Sunday at 9:00 a.m. every week of the year. Which of the following should the administrator use?
Options
- A0 9 * * 1-5 root /root/script.sh
- B0 9 1 */3 * root /root/script.sh
- C0 9 * * 6,0 root /root/script.sh
- D0 9 1 * * root /root/script.sh
How the community answered
(59 responses)- A7% (4)
- B8% (5)
- C81% (48)
- D3% (2)
Explanation
Crontab fields are ordered: minute hour day-of-month month day-of-week. In cron, days of the week are numbered 0 (Sunday) through 6 (Saturday). The expression '0 9 * * 6,0' means: at minute 0, hour 9, any day of month, any month, on Saturday (6) and Sunday (0). Option A uses '1-5' which is Monday through Friday. Option B uses '1 */3 *' which targets the 1st day of every third month. Option D uses '1 * *' which targets the 1st of every month.
Topics
Community Discussion
No community discussion yet for this question.