hardMultiple ChoiceObjective-mapped
XK0-006 Practice Question: Ensure that a custom script…
An administrator needs to ensure that a custom script /usr/local/bin/backup.sh runs every day at 2:00 AM and logs output to /var/log/backup.log. How should this be configured using systemd?
⚠ Common exam trap
Test-takers frequently default to cron (Option B) because it is familiar, but the question explicitly requires a systemd-based solution, testing knowledge of systemd timer units as the correct modern approach.
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 that activates a service unit, with OnCalendar=daily and the desired time.
Systemd timer units are the modern, recommended method for scheduling recurring tasks on Linux systems that use systemd. By creating a timer unit with `OnCalendar=daily` and specifying the desired time (e.g., `02:00:00`), the associated service unit will execute `/usr/local/bin/backup.sh` at 2:00 AM daily. The service unit can also redirect output to `/var/log/backup.log` using standard output/error directives, ensuring logging is handled natively within the systemd framework.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use anacron with a delay of 0 and a period of 1 day.
Why it's wrong here
Anacron does not support specific times; it runs after boot if missed.
- ✗
Add a cron job with '0 2 * * * /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1'.
Why it's wrong here
Cron is not the systemd-native approach; timers are preferred.
- ✓
Create a systemd timer unit that activates a service unit, with OnCalendar=daily and the desired time.
Why this is correct
Systemd timers allow precise scheduling and integrate with journald for logging.
- ✗
Place the script in /etc/cron.daily/ and set the time with the 'START_HOURS_RANGE' variable.
Why it's wrong here
Cron.daily runs at 6:25 AM by default, not 2:00 AM.
Go deeper
Related to this question
Learn chapter
Linux Fundamentals and History
Key term
Linux
Linux is an open-source operating system that manages computer hardware and software, widely used in servers, desktops, and embedded systems.
Key term
Service
A service is a software component or system that performs a specific function and is available to be used by other programs or users over a network.
About these practice questions
Courseiva writes every XK0-006 question from scratch — 979 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
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.