Linux+ Exam XK0-004: Schedule Cron Job for Free Disk Space - CompTIA Linux+

Schedule Cron Job for Free Disk Space

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?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

A.

The correct answer is B.

The cron job needs to run at 1:15 p.m. every Friday, so the appropriate time and day of the week fields need to be set. The minute field can be set to 15, and the hour field can be set to 13 (since this is 1:00 p.m. in 24-hour time). The day of the week field should be set to 5, which represents Friday.

The command to report the amount of free disk space on the system is "df", and the output needs to be sent to a file named "freespace". To do this, the ">" symbol is used to redirect output to a file.

Therefore, the correct cron job entry is: 15 13 * * 5 df > /freespace

Option A is incorrect because it runs at 1:15 a.m. instead of 1:15 p.m.

Option C is incorrect because it runs at 1:15 a.m. on Saturday instead of 1:15 p.m. on Friday.

Option D is incorrect because it runs on the 6th day of every month at 1:15 p.m., regardless of which day of the week it falls on.