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

Load .bashrc and Environment Variables in Cron

Cron runs jobs with a bare, non-login, non-interactive shell, so it never reads .bashrc or .profile. If your job needs those variables, load them explicitly.

Why cron ignores .bashrc

Cron starts a minimal shell that is not a login shell and not interactive, so ~/.bashrc and ~/.profile are never sourced. That is why a command that works in your terminal fails under cron with 'command not found' or missing variables.

Source a profile in the job

0 * * * * . $HOME/.profile; /path/job.sh loads your environment first. Use a file with your exports; sourcing the full interactive .bashrc can error because it often bails early for non-interactive shells.

Or set variables in the crontab

Put the exact variables at the top of the crontab file:

PATH=/usr/local/bin:/usr/bin:/bin
MY_API_KEY=abc123
0 * * * * /path/job.sh

Best practice

Keep a small env file with just what the job needs and source that, rather than the whole shell startup.

FAQ

Why doesn't cron read my .bashrc?

Cron uses a non-login, non-interactive shell, which never sources ~/.bashrc or ~/.profile. Any environment set there is invisible to the job.

How do I load environment variables in a cron job?

Source a profile in the command (. $HOME/.profile; /path/job.sh) or set the variables at the top of the crontab file, including PATH.

Why does my command work in the terminal but not in cron?

Your terminal loads .bashrc and a full PATH; cron doesn't. Set PATH in the crontab or source your env file before the command.