Each part is a number or symbol that tells when to run the command.
Use * to mean 'every' for that time part.
Examples
Runs the script at 7:00 AM every day.
Raspberry Pi
07 * * * /home/pi/turn_on_light.sh
Runs backup script at 10:30 PM every Monday.
Raspberry Pi
3022 * * 1 /home/pi/backup.sh
Runs the status check every 15 minutes.
Raspberry Pi
*/15 * * * * /home/pi/check_status.sh
Sample Program
This example shows how to edit the cron table to schedule a script. You open the cron editor, add a line with the time and command, then save it.
Raspberry Pi
# Open terminal on Raspberry Pi
crontab -e
# Add this line to run a script every day at 8 AM08 * * * /home/pi/myscript.sh
# Save and exit the editor# The script /home/pi/myscript.sh will run automatically at 8 AM daily
OutputSuccess
Important Notes
Make sure your script has execute permission: chmod +x /home/pi/myscript.sh
Use full paths in your scripts because cron runs with limited environment.
Check cron logs if your job does not run: grep CRON /var/log/syslog
Summary
Cron jobs automate tasks by running commands at scheduled times.
Use the crontab editor to add or change cron jobs.
Always test your scripts manually before scheduling them.
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