Cron generator

Linux crontab generator

Create Linux crontab expressions with plain-English explanations, examples and safety checks for paths, shells and environment variables.

0 2 * * *
Cron has a small environment.
Use full paths for scripts, binaries, config files, and log destinations.
Output needs somewhere to go.
Redirect stdout and stderr so failures are visible after the job runs unattended.
Test the command first.
Run the exact command manually as the same user before saving it in crontab.

When this schedule fits

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.

Copy-ready example

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

Common mistakes

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.

Useful crontab patterns

# Every day at 02:00
0 2 * * *

# Every 10 minutes
*/10 * * * *

# Every Monday at 07:15
15 7 * * 1

How to test it

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.

FAQ

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.

Use the full builder

Open the Cron Expression Builder to edit this schedule, explain a pasted expression, and preview upcoming run times.