QA
Beginner LevelLinux Commands & SysAdmin

How does the Cron daemon schedule recurring tasks via crontab -e?

❓ Interview Prompt: Explain Cron daemon, crontab -e syntax, 5-field time expressions (* * * * *), and environment logging.

The Cron daemon executes background tasks on a scheduled recurring basis defined in user crontabs ('crontab -e').

5-Field Time Syntax:

' * command_to_execute'

•
Field 1: Minute (0-59)
•
Field 2: Hour (0-23)
•
Field 3: Day of Month (1-31)
•
Field 4: Month (1-12)
•
Field 5: Day of Week (0-6, 0=Sunday)

Code Implementation Example

bash
# Open crontab editor
crontab -e

# Sample Crontab Entries:
# Run backup script every day at 2:30 AM
30 2 * * * /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1

# Run cleanup every 15 minutes
*/15 * * * * /usr/local/bin/clean-tmp.sh
💡Configuring recurring background cron tasks via crontab.
🎯 Interview Key Takeaway

Use crontab -e to schedule recurring tasks, redirecting stdout/stderr to log files for debugging.

More Linux Commands & SysAdmin Interview Questions

Beginner LevelLinux Commands & SysAdmin

How do Linux File Permissions (chmod, chown, chgrp) work in Octal and Symbolic notation?

Beginner LevelLinux Commands & SysAdmin

What is the Linux Filesystem Hierarchy Standard (/bin, /etc, /var, /usr, /opt, /tmp)?

Beginner LevelLinux Commands & SysAdmin

What are File Descriptors (0=stdin, 1=stdout, 2=stderr) and Redirection (>, >>, 2>&1)?