Raspberry Pi - Automation and SchedulingYou 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.pyB15 7 * * 1-5 /usr/bin/python3 /home/pi/script.pyC15 7 * * 6,7 /usr/bin/python3 /home/pi/script.pyD15 7 1-5 * * /usr/bin/python3 /home/pi/script.pyCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand cron fields for time and daysThe 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).Step 2: Check each option15 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.Final Answer:15 7 * * 1-5 /usr/bin/python3 /home/pi/script.py -> Option BQuick 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:MISTAKESSwapping hour and minute fieldsUsing day_of_month instead of day_of_week for weekdaysConfusing weekend days with weekdays
Master "Automation and Scheduling" in Raspberry Pi9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Raspberry Pi Quizzes Automation and Scheduling - systemd service for auto-start - Quiz 11easy Data Logging and Databases - SQLite database for sensor data - Quiz 2easy MQTT for IoT - MQTT with QoS levels - Quiz 13medium MQTT for IoT - Why MQTT is the IoT standard - Quiz 5medium MQTT for IoT - Multi-device MQTT network - Quiz 15hard Security and Deployment - User authentication basics - Quiz 12easy Security and Deployment - HTTPS for web server - Quiz 10hard Security and Deployment - HTTPS for web server - Quiz 12easy Web Server and API - Flask web server on Raspberry Pi - Quiz 1easy Web Server and API - Why web servers enable remote IoT control - Quiz 5medium