crontool
Paste a schedule, read it in English, see the next runs.

Setting Environment Variables in Cron

Cron does not read your ~/.bashrc, so variables like PATH, HOME, or API keys are empty. Define them directly at the top of the crontab, or source an env file inside the job. That is the fix for most "works in terminal, fails in cron" bugs.

Define vars at the top of the crontab

Run crontab -e and put assignments above your jobs (no export, no spaces around =):

PATH=/usr/local/bin:/usr/bin:/bin
MAILTO=you@example.com
APP_ENV=production
0 2 * * * /opt/app/run.sh

Or source a file inside the job

For many secrets, keep them in a file and load it per job:

0 2 * * * . /opt/app/.env; /opt/app/run.sh

Why the terminal works but cron does not

Interactive shells load /etc/profile and ~/.bashrc; cron does not. Anything set there is invisible to cron. Either restate it in the crontab or source it explicitly.

FAQ

How do I set an environment variable in crontab?

Add lines like NAME=value above your job entries in crontab -e. Do not use export and do not put spaces around the equals sign.

Why is $PATH empty in my cron job?

Cron starts with a minimal environment and does not read ~/.bashrc. Set PATH=/usr/local/bin:/usr/bin:/bin at the top of the crontab.

How do I load a .env file in a cron job?

Source it inline: 0 2 * * * . /opt/app/.env; /opt/app/run.sh. The dot loads the file into the job's shell before the command runs.