A system administrator created a timer unit called backup.timer in /etc/systemd/system:
[Unit]
Description=Run backup script after boot
[Timer]
OnBootSec=5min
# No [Install] section present
After running systemctl daemon-reload, executing systemctl enable --now backup.timer, and confirming the backup ran once, the administrator rebooted the server. On the next boot, systemctl list-timers --all showed that backup.timer was inactive and the backup service never ran.
Which change to the timer file ensures it is automatically started on every boot so that the backup runs five minutes after startup?
Add Persistent=true under the [Timer] section
Add DefaultDependencies=no under the [Unit] section
Add an [Install] section containing WantedBy=timers.target and re-enable the timer
Timers must be linked into a target that is pulled in at boot. Adding an [Install] section with WantedBy=timers.target lets systemctl enable backup.timer create the appropriate symlink in /etc/systemd/system/timers.target.wants/, so the timer activates each time the system reaches timers.target during boot. Adding Persistent=true only affects missed calendar events; DefaultDependencies=no alters ordering but does not enable the unit; enabling the service instead of the timer starts the backup immediately at every boot rather than on the timer schedule.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the purpose of timers.target in systemd?
Open an interactive chat with Bash
What does Persistent=true do in a systemd timer unit?
Open an interactive chat with Bash
Why does DefaultDependencies=no break systemd unit logic?