Challenge - 5 Problems
Cron Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate1:30remaining
What is the output of this cron schedule expression?
Given the cron schedule expression
30 14 * * 1-5, when will the cron job run?Attempts:
2 left
💡 Hint
Remember, the fields are: minute, hour, day of month, month, day of week.
✗ Incorrect
The expression means minute 30, hour 14 (2 PM), every day of month, every month, and days Monday (1) through Friday (5). So it runs at 2:30 PM on weekdays.
❓ Predict Output
intermediate1:30remaining
What will this cron job output?
A cron job runs the command
echo $(date +"%H:%M") > /home/pi/time.txt every hour at minute 0. What will be the content of time.txt after the job runs at 3 PM?Attempts:
2 left
💡 Hint
The format string %H:%M gives hour in 24-hour format and minutes.
✗ Incorrect
The command outputs the current hour and minute in 24-hour format, so at 3 PM it writes '15:00' to the file.
🔧 Debug
advanced2:00remaining
Why does this cron job not run?
A user added this line to their crontab:
0 9 * * * /home/pi/myscript.sh. The script has execute permission and runs fine manually. But the cron job never runs. What is the most likely reason?Attempts:
2 left
💡 Hint
Cron jobs run with a limited environment and may not have the same PATH as your user.
✗ Incorrect
Cron runs with a minimal environment. If the script relies on environment variables or relative paths, it may fail. The path is correct and script is executable, so environment is the likely cause.
🧠 Conceptual
advanced1:30remaining
How to schedule a cron job to run every 15 minutes?
Which cron schedule expression correctly runs a job every 15 minutes?
Attempts:
2 left
💡 Hint
The slash (/) operator in cron means 'every'.
✗ Incorrect
The expression '*/15 * * * *' means every 15 minutes (0,15,30,45), every hour, every day, etc. A ('0-15 * * * *') runs every minute from 0 to 15. B runs only at minute 15 each hour. C explicitly lists the minutes.
📝 Syntax
expert1:30remaining
What error does this crontab line cause?
Consider this crontab line:
0 25 * * * /home/pi/script.sh. What happens when cron tries to run this?Attempts:
2 left
💡 Hint
Hours in cron must be between 0 and 23.
✗ Incorrect
The hour field must be 0-23. 25 is invalid, so cron will reject the line and not run the job.