Yes, Bob it works perefect now, thanks.

Regards.



----- Original Message -----
From: "Bob Showalter" <[EMAIL PROTECTED]>
To: "'Rafael Morales'" <[EMAIL PROTECTED]>, beginners@perl.org
Subject: RE: Trouble  running a script with cron
Date: Wed, 29 Dec 2004 15:42:57 -0500

> 
> Rafael Morales wrote:
> > Hi list.
> >
> > I need to put a script in cron, but this script needs exec some
> > Oracle variables for work fine, these variables are: export 
> > ORACLE_HOME=/oracle/app/product/9.2.0
> > export ORACLE_SID=galdb
> > export LD_LIBRARY_PATH=/oracle/app/product/9.2.0/lib32
> > export NLS_LANG='MEXICAN SPANISH_MEXICO.WE8MSWIN1252'
> > export NLS_NUMERIC_CHARACTERS='.,'
> >
> > However when I try to exec these variables in the script (with
> > "system" or "exec"), does not work well, this a part of my 
> > script: #!/usr/bin/perl
> > use strict;
> >
> > system "export ORACLE_HOME=/oracle/app/product/9.2.0";
> > system "export ORACLE_SID=galdb";
> > system "export LD_LIBRARY_PATH=/oracle/app/product/9.2.0/lib32";
> > system "export NLS_LANG=\'MEXICAN SPANISH_MEXICO.WE8MSWIN1252\'";
> > system "export NLS_NUMERIC_CHARACTERS=\'.,\'";
> 
> This should be written as:
> 
>    BEGIN {
>       $ENV{ORACLE_HOME} = '/oracle/app/product.9.2.0';
>       $ENV{ORACLE_SID} = 'galdb';
>       ... and so on ...
>    }
> 
> The BEGIN { } block is probably needed so the vars are set before the "use
> DBD::Oracle" happens.
> 
> The system() approach won't work because it only changes the environment
> variables in the child process; you need to set the %ENV hash instead.
> 
> (But you may want to consider setting the variables in the crontab instead
> of here)
> 
> HTH
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>

-- 
_______________________________________________
Get your free email from http://mymail.bsdmail.com

Powered by Outblaze

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to