nerdexam
CompTIA

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'…

System Management

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)
  • A
    7% (4)
  • B
    8% (5)
  • C
    81% (48)
  • D
    3% (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

#crontab#task scheduling#Linux commands#system utilities

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice