nerdexam
IBM

000-221 · Question #27

000-221 Question #27: Real Exam Question with Answer & Explanation

The correct answer is D. Create a file containing the job commands, using the 'at' command as the final line of the file.. The 'at' command can schedule a one-time job, and by placing another 'at' invocation as the final command in the job file, the job reschedules itself to run again after completing, ensuring the five-hour gap starts after the previous run finishes.

Question

A user wants to run a batch job repetitively, but requires that each invocation starts five hours after the previous run finishes. What strategy will accomplish this?

Options

  • ACreate a wrapper script that launches the job in the background and then sleeps for the designated
  • BSubmit the job with 'at', using the average run time of the job plus five hours as the interval.
  • CAdd an entry to the crontab to submit the job every five hours.
  • DCreate a file containing the job commands, using the 'at' command as the final line of the file.

Explanation

The 'at' command can schedule a one-time job, and by placing another 'at' invocation as the final command in the job file, the job reschedules itself to run again after completing, ensuring the five-hour gap starts after the previous run finishes.

Common mistakes.

  • A. A background launch with sleep would start the timer immediately when the job is launched, not after it finishes, so the five-hour gap would not reliably follow job completion.
  • B. Using 'at' with a fixed average-time interval is unreliable because actual run times vary, meaning the next job could start before or too long after the previous one completes.
  • C. Cron schedules jobs at fixed calendar intervals regardless of whether a previous instance has finished, so it cannot enforce a delay that begins only after a job completes.

Concept tested. Scheduling self-rescheduling jobs using 'at' command

Reference. https://man7.org/linux/man-pages/man1/at.1.html

Community Discussion

No community discussion yet for this question.

Full 000-221 Practice