Intermediate · 12 min · practise every command in the built-in terminal

🎯 Mission Briefing: The Silent Cron Job

Last night's backup never happened. The job is scheduled, nobody touched the server, and there's no error message anywhere obvious. Cron jobs fail quietly — your job is to find out why.

Your objective

Confirm the job is scheduled, find evidence of the failure in the logs, fix the cause, and prove the backup works.

Investigation toolkit

crontab -l                           # What is scheduled, and when?
journalctl -u cron -n 20             # What did cron do last night?
grep CRON /var/log/syslog            # The same story in the classic syslog
ls -l ~/scripts/backup.sh            # Can the script actually be executed?

Fix and verify

chmod +x ~/scripts/backup.sh         # A script needs the execute bit to run directly
~/scripts/backup.sh                  # Run it by hand, the same way cron does
ls -lh ~/backups                     # Did the backup file appear?

💡 Exit status 126 means "found the file, but couldn't execute it" — almost always a permissions problem.

Practice tasks

  1. Show which jobs are scheduled in your crontab
  2. Find the log entry that shows the backup job failing
  3. Check the permissions of the backup script
  4. Fix the script so cron can execute it
  5. Run the backup by hand and confirm it created an archive

Missions