Challenge - 5 Problems
Cron Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate1:30remaining
What is the output of this cron schedule?
Given the cron expression
30 2 * * 1-5, when will the scheduled task run?Attempts:
2 left
💡 Hint
Remember the order of fields in a cron expression: minute, hour, day of month, month, day of week.
✗ Incorrect
The cron expression means: minute 30, hour 2, every day of month, every month, days Monday to Friday (1-5). So it runs at 2:30 AM on weekdays.
📝 Syntax
intermediate1:30remaining
Identify the syntax error in this cron job entry
Which option shows a syntax error in a cron job entry?
Attempts:
2 left
💡 Hint
Check the valid range for the hour field in cron.
✗ Incorrect
The hour field must be between 0 and 23. '25' is invalid and causes a syntax error.
❓ optimization
advanced2:00remaining
Optimize this cron schedule for hourly data collection
You want to collect data every hour at 15 minutes past the hour. Which cron expression is the most efficient and correct?
Attempts:
2 left
💡 Hint
Remember the order: minute, hour, day, month, weekday.
✗ Incorrect
Option C runs the script at minute 15 of every hour, every day, which matches the requirement.
🔧 Debug
advanced2:00remaining
Why does this cron job not run as expected?
A cron job entry is:
0 6 * * * /home/pi/data_collect.sh. The script runs fine manually but does not run at 6 AM. What is the most likely cause?Attempts:
2 left
💡 Hint
Check permissions and environment differences between manual and cron runs.
✗ Incorrect
If the script is not executable by the cron user, it won't run even if scheduled correctly.
🧠 Conceptual
expert3:00remaining
How to ensure data collection runs even if the previous run is still active?
You schedule a data collection script every 10 minutes with cron. Sometimes the script takes longer than 10 minutes. Which approach ensures no overlapping runs?
Attempts:
2 left
💡 Hint
Think about how to prevent multiple script instances from running simultaneously.
✗ Incorrect
Using a lock file prevents overlapping runs by letting the script detect if another instance is active.