Crontab Generator Časté dotazy
Generate cron expressions visually
What does each field in a cron expression mean?
Cron uses 5 fields: minute (0-59), hour (0-23), day of month (1-31), month (1-12), and day of week (0-6, Sunday=0). For example, '30 14 * * 5' runs at 2:30 PM every Friday. Use * for 'every value', ranges like 1-5, lists like 1,15, or steps like */10.
Why isn't my cron job running?
Common issues: 1) Cron daemon not running (check with 'systemctl status cron'), 2) Wrong user's crontab (use 'crontab -l' to verify), 3) Environment/PATH differences (use absolute paths), 4) Syntax errors in the expression, 5) No output redirection (add '>> /var/log/job.log 2>&1' to see errors). Check system logs with 'journalctl -u cron'.
How do I run a cron job every 5 minutes?
Use '*/5 * * * *'. The */5 in the minute field means 'every 5 minutes' (runs at :00, :05, :10, :15, etc.). Similarly, */10 runs every 10 minutes, */15 every 15 minutes, and so on.
Can I run cron jobs during business hours only?
Yes. For weekdays 9 AM to 5 PM hourly: '0 9-17 * * 1-5'. For every 15 minutes during business hours: '*/15 9-17 * * 1-5'. The hour range 9-17 and weekday range 1-5 (Monday-Friday) restrict execution to business hours.
How do I debug a cron job that's failing?
1) Add output redirection: 'command >> /tmp/debug.log 2>&1', 2) Check the log file for errors, 3) Run the exact command manually to test, 4) Verify the cron daemon is running, 5) Check system logs (journalctl -u cron), 6) Ensure you're using absolute paths for commands and files, 7) Test environment with '* * * * * env > /tmp/cron-env.txt' to see what's available.
What's the difference between day of month and day of week?
When both fields are specified (not *), cron uses OR logic. '0 0 13 * 5' runs 'on the 13th OR on Friday', not 'on Friday the 13th'. If you only want Fridays, use '0 0 * * 5'. If you only want the 13th, use '0 0 13 * *'. To get complex day logic, use a script that checks the date.
Průvodce
Generate cron expressions visually
Cron Syntax Explained
Cron's five-field syntax is deceptively simple but incredibly powerful. This guide breaks down each field, every special character, and the rules that govern how they combine to create schedules ranging from 'every minute' to 'second Tuesday of odd-numbered months at 3:47 AM.'