Bird
0
0

You want to run a Python script every weekday at 7:15 AM on your Raspberry Pi. Which cron job entry is correct?

hard🚀 Application Q15 of 15
Raspberry Pi - Automation and Scheduling
You want to run a Python script every weekday at 7:15 AM on your Raspberry Pi. Which cron job entry is correct?
A7 15 * * 1-5 /usr/bin/python3 /home/pi/script.py
B15 7 * * 1-5 /usr/bin/python3 /home/pi/script.py
C15 7 * * 6,7 /usr/bin/python3 /home/pi/script.py
D15 7 1-5 * * /usr/bin/python3 /home/pi/script.py
Step-by-Step Solution
Solution:
  1. Step 1: Understand cron fields for time and days

    The format is minute hour day_of_month month day_of_week. To run at 7:15 AM, minute=15, hour=7. Weekdays are days 1-5 (Monday to Friday).
  2. Step 2: Check each option

    15 7 * * 1-5 /usr/bin/python3 /home/pi/script.py correctly uses '15 7 * * 1-5' for 7:15 AM on weekdays. 7 15 * * 1-5 /usr/bin/python3 /home/pi/script.py swaps hour and minute. 15 7 * * 6,7 /usr/bin/python3 /home/pi/script.py uses weekend days (6,7). 15 7 1-5 * * /usr/bin/python3 /home/pi/script.py uses day_of_month 1-5, not weekdays.
  3. Final Answer:

    15 7 * * 1-5 /usr/bin/python3 /home/pi/script.py -> Option B
  4. Quick Check:

    Weekday cron = 1-5, time 7:15 = 15 7 [OK]
Quick Trick: Weekdays are 1-5 in cron day_of_week field [OK]
Common Mistakes:
MISTAKES
  • Swapping hour and minute fields
  • Using day_of_month instead of day_of_week for weekdays
  • Confusing weekend days with weekdays

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes