![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| environment variables | radhika03 | Shell Programming and Scripting | 3 | 01-22-2007 10:58 AM |
| Variables are not getting exported while running the script in cronjob | csaha | Shell Programming and Scripting | 7 | 03-21-2006 01:32 PM |
| environment variables | sumsin | High Level Programming | 6 | 03-13-2006 08:17 AM |
| help..Environment variables... | sekar sundaram | UNIX for Dummies Questions & Answers | 3 | 08-30-2005 12:35 AM |
| environment variables | spavlov | UNIX for Dummies Questions & Answers | 3 | 08-20-2003 06:49 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Environment variables causing cronjob to fail
I am trying to run a script which makes use of these environment variables, hence i need to export them out.
i've posted a similar post in an oracle forum. I've posted the same qn here to get some advise on the scripting aspect. i execute my program in an unix environment by typeing "export_file.sh myscript.pl" at the prompt. it runs successfully. However when i set cronjob 0 2 * * * export_file.sh myscript.pl, i get a load of error messages. my export file---------- Code:
export ORACLE_BASE=/directory1/oracle export ORACLE_HOME=/directory1/oracle/product/9.0.1 export ORACLE_TERM=386 export LC_LIBRARY_PATH=$ORACLE_HOME/lib export PATH=.:$PATH:$ORACLE_HOME/bin export DBSTR='dbi:Oracle:' export DBUSER='username/pass@abc' Code:
use DBI;use ENV;
my $dbh = DBI->connect($DBSTR, $DBUSER, '', { AutoCommit => 0 } )
my $sth = $dbh->prepare( "--some statement; END;" )
$sth->execute()
$sth->finish();
DBI connect('','username/pass@abc',...) failed: Error while trying to retrieve text for error ORA-12154 (DBD ERROR: OCIServerAttach) at myscript.pl line 20 Can't call method "prepare" without a package or object reference at myscript.pl line 21. #ERROR : Error while trying to retrieve text for error ORA-12154 (DBD ERROR: OCIServerAttach). |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
why not this
Why dont you run the script as
. .export.sh from your .profile file. Then your current shell will have this parameters set. Or if it should be visible to all users put the variable declarations in /etc/profile file. |
|
#3
|
|||
|
|||
|
Hi ranj@chn,
thank you for your reply. It was a silly mistake. Some of my paths were invalid. I amended the paths, and it could work. |
|||
| Google The UNIX and Linux Forums |