Challenge - 5 Problems
Crontab Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of this crontab entry?
Given the crontab entry below, what will be the output when it runs?
0 5 * * * echo "Backup started" >> /tmp/backup.logAttempts:
2 left
💡 Hint
Remember that '>>' appends output to a file and the schedule '0 5 * * *' means 5:00 AM every day.
✗ Incorrect
The crontab entry runs the echo command at 5:00 AM every day. The '>>' operator appends the output to the file /tmp/backup.log without overwriting it. It does not print to the terminal.
📝 Syntax
intermediate2:00remaining
Which crontab entry is syntactically correct?
Select the crontab entry that will NOT cause a syntax error when saved.
Attempts:
2 left
💡 Hint
Minutes must be between 0-59 and hours between 0-23 in crontab.
✗ Incorrect
Option C uses valid minute (30) and hour (14) values. Option C has minute 60 which is invalid. Option C has hour 25 which is invalid. Option C has day of month 0 which is invalid.
🔧 Debug
advanced2:00remaining
Why does this crontab entry not run the script?
A user added this line to their crontab:
But the script does not run at 3 AM. What is the most likely reason?
0 3 * * * /home/user/myscript.shBut the script does not run at 3 AM. What is the most likely reason?
Attempts:
2 left
💡 Hint
Check file permissions and execution rights for scripts run by cron.
✗ Incorrect
If the script lacks execute permission, cron cannot run it. The time format is valid, and user crontabs do not require a username field. Cron can run scripts from any accessible directory.
🚀 Application
advanced2:00remaining
Schedule a script to run every 15 minutes using crontab
Which crontab entry correctly runs /usr/local/bin/cleanup.sh every 15 minutes?
Attempts:
2 left
💡 Hint
Use the step value syntax to run commands at intervals.
✗ Incorrect
Option D uses '*/15' which means every 15 minutes. Option D runs only at minute 15 each hour. Option D runs at 0,15,30,45 minutes which is also every 15 minutes but option D is the standard concise form. Option D runs every minute from 0 to 15, not every 15 minutes.
🧠 Conceptual
expert2:00remaining
What happens if you edit crontab with 'crontab -e' and save an empty file?
If a user runs 'crontab -e' and deletes all lines, saving an empty file, what is the effect on their scheduled jobs?
Attempts:
2 left
💡 Hint
Think about what an empty crontab means for scheduled tasks.
✗ Incorrect
Saving an empty crontab removes all scheduled jobs for that user. Cron will have no jobs to run for that user until new entries are added.