Linux crontab generator
Create Linux crontab expressions with plain-English explanations, examples and safety checks for paths, shells and environment variables.
Create Linux crontab expressions with plain-English explanations, examples and safety checks for paths, shells and environment variables.
The expression 0 2 * * * runs every day at 02:00 server time. It is a common choice for backups, file exports, report generation, database maintenance, and other jobs that should run outside normal traffic. Before using it, confirm the server timezone with date and check whether daylight saving changes matter for the task.
SHELL=/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin MAILTO=ops@example.com 0 2 * * * /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1
The classic Linux crontab mistake is writing a command that only works in your interactive shell. Cron may not load the same profile, path, working directory, language runtime, or environment variables. Another mistake is hiding errors by redirecting output to /dev/null too early. Keep logs until the job has proven itself, then reduce noise once you know what normal looks like.
# Every day at 02:00 0 2 * * * # Every 10 minutes */10 * * * * # Every Monday at 07:15 15 7 * * 1
Open your crontab with crontab -e, add the schedule, then watch the log file after the next expected run. If the script touches protected files, check which user owns the crontab. For production backups, pair the cron entry with a restore test and an alert when the log does not update on time.
Which timezone does crontab use? Usually the server timezone. Check it with date before scheduling jobs that depend on local time.
Why does my script work manually but not in cron? Cron has a smaller environment. Use full paths and define the variables your script needs.
Should I redirect output? Yes. Send output to a log file while testing so errors are visible after the job runs unattended.
Open the Cron Expression Builder to edit this schedule, explain a pasted expression, and preview upcoming run times.
Every 5 minutesEvery hourGitHub Actions guideCron not running?