nerdexam
CompTIA

XK0-005 · Question #10380

A Linux administrator needs to schedule a backup job to run every Friday at 2:15 a.m. Which of the following lines should the administrator add to the crontab file?

The correct answer is A. 15 2 * * 5 /bin/backup_job.sh. To schedule a job to run at a specific time on a particular day of the week using crontab, the entry must follow the minute, hour, day-of-month, month, day-of-week format.

System Management

Question

A Linux administrator needs to schedule a backup job to run every Friday at 2:15 a.m. Which of the following lines should the administrator add to the crontab file?

Options

  • A15 2 * * 5 /bin/backup_job.sh
  • B2 15 * * 5 /bin/backup_job.sh
  • C2 * * 15 5 /bin/backup_job.sh
  • D2 * 5 15 * /bin/backup_job.sh

How the community answered

(47 responses)
  • A
    83% (39)
  • B
    2% (1)
  • C
    6% (3)
  • D
    9% (4)

Why each option

To schedule a job to run at a specific time on a particular day of the week using `crontab`, the entry must follow the minute, hour, day-of-month, month, day-of-week format.

A15 2 * * 5 /bin/backup_job.shCorrect

The `crontab` fields are ordered as `minute (0-59)`, `hour (0-23)`, `day of month (1-31)`, `month (1-12)`, `day of week (0-7, where 0 and 7 are Sunday)`. For 'every Friday at 2:15 a.m.', the correct minute is `15`, the hour is `2`, and the day of week for Friday is `5`. Asterisks (`*`) are used as wildcards for day of month and month, meaning 'every day of month' and 'every month'.

B2 15 * * 5 /bin/backup_job.sh

This entry specifies 2 minutes past 15 o'clock (3 PM), which is incorrect for 2:15 a.m.

C2 * * 15 5 /bin/backup_job.sh

This entry places '2' in the minute field and '15' in the day of month field, which does not correspond to 2:15 a.m. on Friday.

D2 * 5 15 * /bin/backup_job.sh

This entry places '2' in the minute field, '5' in the day of month, and '15' in the month field, which is incorrect for the desired time and day.

Concept tested: `crontab` scheduling syntax

Source: https://linux.die.net/man/5/crontab

Topics

#Linux scheduling#Cron#Crontab#Task automation

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice