A cron job is a scheduled task that runs automatically at set times or intervals on a Raspberry Pi or other Linux systems.
Click to reveal answer
beginner
How do you edit the cron jobs for the current user?
You use the command crontab -e to open the cron table editor for the current user.
Click to reveal answer
intermediate
What does the cron time format look like?
It has five fields: minute (0-59), hour (0-23), day of month (1-31), month (1-12), and day of week (0-7, Sunday=0 or 7). Each field controls when the task runs.
Click to reveal answer
intermediate
How would you schedule a script to run every day at 7:30 AM?
You write this in crontab: 30 7 * * * /path/to/script.sh. This means at minute 30, hour 7, every day, every month, every day of the week.
Click to reveal answer
intermediate
Why is it important to use full paths in cron jobs?
Because cron runs with a limited environment, using full paths ensures the system finds the commands and scripts correctly.
Click to reveal answer
Which command opens the cron editor for the current user?
Acronedit
Beditcron
Ccron -open
Dcrontab -e
✗ Incorrect
The command crontab -e opens the cron table editor for the current user.
In a cron schedule, what does the '*' symbol mean?
ASkip this field
BEvery possible value for that field
COnly once
DNo value
✗ Incorrect
The '*' means the task runs for every possible value in that time field.
How often will this cron job run? 0 0 * * 0 /home/pi/script.sh
AEvery Sunday at midnight
BEvery day at midnight
CEvery hour on Sunday
DEvery minute on Sunday
✗ Incorrect
The '0' in the day of week field means Sunday, so it runs at 00:00 every Sunday.
Why should you use full paths in cron commands?
ABecause cron has a limited environment and may not find commands without full paths
BTo make the command shorter
CTo make the command run faster
DIt is not necessary to use full paths
✗ Incorrect
Cron runs with a minimal environment, so full paths ensure commands are found and run correctly.
What does the following cron time mean? */15 * * * *
AEvery 15 days
BEvery 15 hours
CEvery 15 minutes
DEvery 15 seconds
✗ Incorrect
The '*/15' in the minute field means every 15 minutes.
Explain how to create a cron job that runs a backup script every day at 2 AM on a Raspberry Pi.
Think about the time fields and how to edit the cron table.
You got /5 concepts.
Describe why cron jobs might fail if you do not use full paths or environment variables.
Consider what environment cron runs in compared to your normal terminal.
You got /5 concepts.
Practice
(1/5)
1. What is the main purpose of a cron job on a Raspberry Pi?
easy
A. To update the Raspberry Pi operating system
B. To manually execute commands in the terminal
C. To schedule tasks to run automatically at specific times
D. To install new software packages
Solution
Step 1: Understand what cron jobs do
Cron jobs are used to automate tasks by running commands or scripts at scheduled times without manual intervention.
Step 2: Compare options with cron job purpose
Only To schedule tasks to run automatically at specific times describes scheduling tasks automatically, which matches the purpose of cron jobs.
Final Answer:
To schedule tasks to run automatically at specific times -> Option C