nerdexam
CompTIA

XK0-004 · Question #416

An administrator wants to run a script on the second Monday of every month. The script should be executed at 7:00 a.m. and 1:00 p.m. Which of the following entries to the crontab will accomplish this?

The correct answer is A. Option A. Scheduling a job on the second Monday of every month requires constraining the day-of-month field to 8-14 while setting day-of-week to Monday.

Scripting, Containers and Automation

Question

An administrator wants to run a script on the second Monday of every month. The script should be executed at 7:00 a.m. and 1:00 p.m. Which of the following entries to the crontab will accomplish this?

Exhibit

XK0-004 question #416 exhibit

Options

  • AOption A
  • BOption B
  • COption C
  • DOption D

How the community answered

(25 responses)
  • A
    84% (21)
  • B
    8% (2)
  • C
    4% (1)
  • D
    4% (1)

Why each option

Scheduling a job on the second Monday of every month requires constraining the day-of-month field to 8-14 while setting day-of-week to Monday.

AOption ACorrect

A cron entry such as '0 7,13 8-14 * 1' correctly targets the second Monday because days 8 through 14 of any month always contain exactly one Monday. Setting day-of-week to 1 (Monday) combined with that day-of-month range guarantees the second occurrence. The comma-separated hours 7 and 13 handle the 7:00 a.m. and 1:00 p.m. execution times in a single entry.

BOption B

Option B uses a day-of-month range or day-of-week value that does not reliably isolate the second Monday across all months.

COption C

Option C does not correctly combine the 8-14 day-of-month window with the Monday day-of-week constraint needed to target only the second Monday.

DOption D

Option D fails to specify both execution times with a comma-separated hour field or uses an incorrect day range for isolating the second Monday.

Concept tested: Crontab scheduling for nth weekday of the month

Source: https://www.man7.org/linux/man-pages/man5/crontab.5.html

Topics

#crontab#task scheduling#cron syntax#second Monday

Community Discussion

No community discussion yet for this question.

Full XK0-004 Practice