[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What is the correct way to set up login environment in crontab?
From: |
Peng Yu |
Subject: |
Re: What is the correct way to set up login environment in crontab? |
Date: |
Wed, 9 Nov 2011 10:29:52 -0600 |
On Wed, Nov 9, 2011 at 7:45 AM, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
> On Tue, Nov 08, 2011 at 09:46:37PM -0600, Peng Yu wrote:
>> I need to use cron to run some job. I know that cron only set up very
>> basic environment. I'd like to duplicate my login environment.
>
> Just source /etc/profile and your ~/.bash_profile or ~/.profile (or
> whatever) from the script that your cron job executes.
>
> Personally I would advise against this. Login environments are for
> interactive logins, not cron jobs.
I sourced my ~/.bashrc, which source some other files. It seems the
environment variables defined in these files are not seen with env.
Why is so?
--
Regards,
Peng