A given crontab entry gives errors and the reason is that it can not read all env variables from bash. I wonder how could I pass all this info to cron
Asked
Active
Viewed 1,373 times
2
-
2To the "off-topic" closer: I'll think you'll find that both (1) `bash` is a programming language as well as a user shell; and (2) `cron` is a tool commonly used by programmers. – paxdiablo Jun 20 '11 at 04:09
1 Answers
3
One trick I've used in the past is to open up a bash session for the specific user and just type:
env >$HOME/.cronenv
You can this source this file from your cron scripts (or directly from the crontabs if you're running an executable you can't change) with something like:
. $HOME/.cronenv
This is, of course, using a thermonuclear warhead to kill a fly. You should really identify the bare minimum that your script requires and just use that.

paxdiablo
- 854,327
- 234
- 1,573
- 1,953