0
0
Linux CLIscripting~5 mins

systemd timers in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a systemd timer?
A systemd timer is a tool in Linux that schedules tasks to run automatically at specific times or intervals, similar to a clock alarm for scripts or commands.
Click to reveal answer
beginner
Which two files are needed to create a systemd timer?
You need a .service file that defines the task to run, and a .timer file that schedules when the task runs.
Click to reveal answer
beginner
How do you start and enable a systemd timer named backup.timer?
Use sudo systemctl start backup.timer to start it now, and sudo systemctl enable backup.timer to make it start automatically on boot.
Click to reveal answer
intermediate
What does the OnCalendar= setting do in a systemd timer file?
It sets the schedule for when the timer triggers, using calendar events like daily, weekly, or specific dates and times.
Click to reveal answer
beginner
How can you check the status and last run time of a systemd timer?
Run systemctl status yourtimer.timer to see if it is active and when it last triggered.
Click to reveal answer
What file extension does a systemd timer unit use?
A.sched
B.service
C.timerunit
D.timer
Which command starts a systemd timer immediately?
Asystemctl start timer.timer
Bsystemctl start timer.service
Csystemctl enable timer.timer
Dsystemctl run timer.timer
What does the OnBootSec= option do in a timer file?
ARuns the task a set number of seconds after boot
BRuns the task at a fixed time daily
CRuns the task every second
DDisables the timer
If you want a task to run every 10 minutes, which timer setting is best?
AOnCalendar=hourly
BOnUnitActiveSec=10min
COnCalendar=daily
DOnBootSec=10min
How do you check when a systemd timer last triggered?
Ajournalctl -u timer.timer
Bsystemctl status timer.service
Csystemctl status timer.timer
Dcat /var/log/timer.log
Explain how to create and enable a systemd timer to run a backup script every day at 2 AM.
Think about two files and scheduling with OnCalendar.
You got /4 concepts.
    Describe how systemd timers differ from cron jobs and one advantage of using timers.
    Focus on management and features differences.
    You got /4 concepts.