Assuming that just by logging into your account and running myscript.pl,
everything is fine, this should work:
login as root.
In crontab , add this line
12 23 * * * su - <ur_account_name> -c "/usr/local/bin/mine/myscript.pl"  >
/path/name/diag.txt  2>/path/name/diag.err

This will execute .profile before running the script.

-Sumitro.

----- Original Message ----- 
From: "Bruce Shaw" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 24, 2004 1:16 AM
Subject: environment variables in perl scripts


> I've got a working dbi script but I can only get it going live.
>
> If I run it as a crontab entry, it won't work because there's no
environment
> variables.
>
> I've even tried something like:
>
> 12 23 * * * cd /usr/local/bin/mine; ./setup_vars; set > set.txt;
> ./myscript.pl & > diag.txt
>
> where setup_vars is a script that's supposed to set my variables.  I've
also
> got them set in .profile, but when I examine set.txt, none of the
> environment variables are there and diag.txt shows that nothing has worked
> because the variables are missing.
>
> What am I doing wrong?
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.659 / Virus Database: 423 - Release Date: 4/15/2004
>
>
> This communication is intended for the use of the recipient to which it is
> addressed, and may contain confidential, personal and or privileged
> information. Please contact us immediately if you are not the intended
> recipient of this communication, and do not copy, distribute, or take
action
> relying on it. Any communication received in error, or subsequent reply,
> should be deleted or destroyed.
>
>

Reply via email to