0
0
Linux CLIscripting~20 mins

Cron log monitoring in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Cron Log Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
Identify the cron job execution from log output
Given the following snippet from a cron log, what command was executed by cron?
Linux CLI
Jun 10 14:05:01 server CRON[12345]: (root) CMD (/usr/bin/backup.sh)
A/usr/bin/update.sh
B/usr/bin/cleanup.sh
C/usr/bin/restart.sh
D/usr/bin/backup.sh
Attempts:
2 left
💡 Hint
Look for the CMD part in the log line.
Troubleshoot
intermediate
1:30remaining
Diagnose why a cron job did not run
You see no output or log entries for a cron job scheduled at 3 AM daily. Which of these is the most likely reason?
AThe system time is set correctly
BThe cron daemon is not running
CThe cron job script has execute permission
DThe cron job is listed in crontab -l
Attempts:
2 left
💡 Hint
If cron daemon is stopped, no jobs run or log.
Configuration
advanced
2:00remaining
Configure cron to log all job outputs to a specific file
Which crontab entry correctly redirects both stdout and stderr of /usr/bin/script.sh to /var/log/script.log?
A0 2 * * * /usr/bin/script.sh > /var/log/script.log 2>&1
B0 2 * * * /usr/bin/script.sh 2> /var/log/script.log
C0 2 * * * /usr/bin/script.sh > /var/log/script.log
D0 2 * * * /usr/bin/script.sh 2>&1 > /var/log/script.log
Attempts:
2 left
💡 Hint
Redirect stdout first, then stderr to the same file.
Best Practice
advanced
1:30remaining
Best practice for monitoring cron job failures
Which method is best to get notified immediately when a cron job fails?
ACheck cron logs manually every day
BWrite output to a local file only
CConfigure cron to send email on job failure
DIgnore failures if jobs run mostly fine
Attempts:
2 left
💡 Hint
Immediate notification helps quick response.
🧠 Conceptual
expert
2:00remaining
Understanding cron log rotation impact
If cron logs are rotated daily and compressed, what is a key consideration for long-term cron job monitoring?
AArchived logs must be decompressed to analyze older cron jobs
BCron jobs stop running after log rotation
CCron daemon automatically deletes old logs without compression
DLog rotation disables cron logging temporarily
Attempts:
2 left
💡 Hint
Compressed logs need special handling to read.