Problem Statement
What is the correct format for a crontab entry?
Explanation
Crontab format: minute (0-59) hour (0-23) day (1-31) month (1-12) weekday (0-7, 0 and 7 are Sunday) command. Example: 30 2 * * * /path/to/script.sh runs at 2:30 AM daily. Special characters: * (any value), */N (every N), N-M (range), N,M (list).
Common patterns: 0 * * * * (every hour), */15 * * * * (every 15 minutes), 0 0 * * 0 (midnight every Sunday), 0 2 1 * * (2 AM on first of month). Special strings: @reboot (at startup), @daily, @weekly, @monthly.
Manage crontab: crontab -e edits user crontab, crontab -l lists entries, crontab -r removes all entries. System-wide: /etc/crontab and /etc/cron.d/. Output: redirect output to file or email sent to user (MAILTO variable).
Debugging: check /var/log/cron or /var/log/syslog for execution, ensure script has execute permissions and correct shebang, use absolute paths in scripts (cron has minimal PATH). Understanding cron enables task automation and scheduled maintenance.
