Bird
0
0

Which of the following is the correct syntax for a cron job that runs a script every day at 3 AM?

easy📝 Syntax Q3 of 15
Raspberry Pi - Data Logging and Databases
Which of the following is the correct syntax for a cron job that runs a script every day at 3 AM?
A* 3 * * * /home/pi/script.sh
B3 0 * * * /home/pi/script.sh
C0 3 * * * /home/pi/script.sh
D0 0 3 * * /home/pi/script.sh
Step-by-Step Solution
Solution:
  1. Step 1: Understand cron time fields

    Cron format is: minute hour day month weekday. To run at 3 AM, hour=3, minute=0.
  2. Step 2: Match correct syntax

    0 3 * * * /home/pi/script.sh uses "0 3 * * *" which means 3:00 AM daily, correct syntax.
  3. Final Answer:

    0 3 * * * /home/pi/script.sh -> Option C
  4. Quick Check:

    Cron time format = minute hour day month weekday [OK]
Quick Trick: Minute first, then hour in cron syntax [OK]
Common Mistakes:
MISTAKES
  • Swapping hour and minute fields
  • Using * incorrectly for hour
  • Misplacing day and month fields

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes