[vox-tech] cron and user environment

Ken Herron vox-tech@lists.lugod.org
Mon, 01 Sep 2003 22:34:53 -0700


--On Monday, September 01, 2003 11:24:44 PM -0500 Jay Strauss 
<me@heyjay.com> wrote:

> How can I setup my environment from a cron job?
>
> I tried:
>
> * * * * * . ~/.bash_profile; env > ~/env.out
>
> but the second command doesn't run.

Are you getting an empty env.out, or no env.out at all? The second 
command is the only one that does anything permanent, so if you're not 
getting env.out, then you don't know that cron executed the job at all.

To start with, check the host's local mail system for any mail from cron. 
If the job produced any output, it should have been mailed to you.

Next, check the cron syslog (/var/log/cron/* on my system). It should log 
the execution of the job and the job's exit code.

Third, see if there's anything in your .bash_profile (or something that 
.bash_profile executes, such as .bashrc) which calls exit.

-- 
Ken Herron