Courseiva

XK0-006 Automation, Orchestration, and Scripting Practice Question

A Linux administrator needs to schedule a maintenance script to run every Monday at 03:15 on a systemd-based server. The script must persist across reboots and must not depend on a user being logged in. Which of the following is the BEST approach?

⚠ Common exam trap

The trap here is assuming that cron is always available and preferred on systemd-based systems, when native timer units are the more reliable and integrated choice.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Create a systemd timer unit with OnCalendar=Mon 03:15:00 and a matching service unit, then enable the timer with systemctl enable --now.

Systemd timers are the modern, native scheduling mechanism on systemd-based Linux distributions. Pairing a timer unit that defines OnCalendar=Mon 03:15:00 with a service unit that runs the script, then enabling the timer, satisfies the requirement for a recurring, reboot-persistent job that runs without any logged-in user. This approach is more robust than legacy cron or one-shot at jobs.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Add the entry to /etc/crontab using the root user field, then run systemctl restart crond.

    Why it's wrong here

    While /etc/crontab supports a user field, this approach relies on a separate cron daemon that may not be installed or enabled on a systemd-based host. It does not leverage the native systemd scheduling framework and requires the cron service to be present and running, making it less reliable than a timer unit for this scenario.

  • ✗

    Place a script in /etc/profile.d/ that invokes the maintenance command, ensuring it runs for every user session.

    Why it's wrong here

    Scripts in /etc/profile.d/ execute only when a login shell is started, which directly contradicts the requirement that the task must not depend on a user being logged in. This mechanism is intended for environment setup, not scheduled job execution, and would never fire at 03:15 on a Monday without an interactive session.

  • ✓

    Create a systemd timer unit with OnCalendar=Mon 03:15:00 and a matching service unit, then enable the timer with systemctl enable --now.

    Why this is correct

    A systemd timer paired with a service unit is the native scheduling mechanism on systemd-based distributions. The OnCalendar directive accepts calendar expressions such as Mon 03:15:00, and enabling the timer with systemctl enable --now ensures it starts immediately and persists across reboots without requiring an interactive login session.

  • ✗

    Create an at job with at 03:15 Mon and save it with atq so it repeats weekly.

    Why it's wrong here

    The at utility schedules one-time jobs, not recurring ones. Although atq lists pending jobs, it cannot make a job repeat weekly. Using at for recurring maintenance would require re-submitting the job every week, which defeats the purpose and does not persist reliably across reboots without additional orchestration.

About these practice questions

One of 781 original XK0-006 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official CompTIA exam blueprint

This XK0-006 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the XK0-006 exam.