XK0-005 · Question #125
A Linux administrator needs to schedule a cron job to run at 1:15 p.m. every Friday to report the amount of free disk space on the system and to send the output to a file named "freespace". Which of…
The correct answer is B. 15 13 * * 5 df > /freespace. The cron job entry 15 13 5 df > /freespace correctly schedules the df command to run at 1:15 p.m. (13:15 in 24-hour format) every Friday (day of week 5) and redirects its output to /freespace.
Question
A Linux administrator needs to schedule a cron job to run at 1:15 p.m. every Friday to report the amount of free disk space on the system and to send the output to a file named "freespace". Which of the following would meet this requirement?
Options
- A13 15 * * 5 df > /freespace
- B15 13 * * 5 df > /freespace
- C15 1 * * 6 df > /freespace
- D15 13 6 * * df > /freespace
How the community answered
(32 responses)- A6% (2)
- B88% (28)
- C3% (1)
- D3% (1)
Why each option
The cron job entry `15 13 * * 5 df > /freespace` correctly schedules the `df` command to run at 1:15 p.m. (13:15 in 24-hour format) every Friday (day of week 5) and redirects its output to `/freespace`.
The minute and hour fields are swapped; `13 15` would mean 3:13 p.m. instead of 1:15 p.m.
The cron syntax follows `minute hour day_of_month month day_of_week command`. Here, `15` is the minute, `13` is 1 p.m. (24-hour format), `*` for day of month and month means every day/month, and `5` represents Friday (where 0 or 7 is Sunday). `df > /freespace` executes the disk free command and redirects its output to the specified file.
`15 1 * * 6` would run at 1:15 a.m. on Saturday, not 1:15 p.m. on Friday.
`15 13 6 * *` would run at 1:15 p.m. on the 6th day of every month, not specifically every Friday.
Concept tested: Cron job scheduling syntax
Source: https://man7.org/linux/man-pages/man5/crontab.5.html
Topics
Community Discussion
No community discussion yet for this question.