- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Why perl script always fails in crontab ?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 03:04 AM
тАО08-27-2008 03:04 AM
Why perl script always fails in crontab ?
But I don't know the script fail in crontab but success in command prompt.
Any ideal ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 03:23 AM
тАО08-27-2008 03:23 AM
Re: Why perl script always fails in crontab ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 03:26 AM
тАО08-27-2008 03:26 AM
Re: Why perl script always fails in crontab ?
Anyway, something like "it fails" only is never a good description of a situation.
Hope this helps!
Regards
Torsten.
__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.
__________________________________________________
No support by private messages. Please ask the forum!
If you feel this was helpful please click the KUDOS! thumb below!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 03:39 AM
тАО08-27-2008 03:39 AM
Re: Why perl script always fails in crontab ?
Check for cron log. the path is
#/var/adm/cron/log
Regards
Atul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 03:42 AM
тАО08-27-2008 03:42 AM
Re: Why perl script always fails in crontab ?
pls check #crontab -l ouput and paste it here
Reagrds
Atul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 03:53 AM
тАО08-27-2008 03:53 AM
Re: Why perl script always fails in crontab ?
cron has no environment.
Your script needs a PATH variable set or must have all external calls include the full path.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 04:51 AM
тАО08-27-2008 04:51 AM
Re: Why perl script always fails in crontab ?
You might be enlightened if you use the 'warnings' pragma (let alone the 'strict' pragma' in your code!
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 05:11 AM
тАО08-27-2008 05:11 AM
Re: Why perl script always fails in crontab ?
Best regards,
Fred
"Reality is just a point of view." (P. K. D.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 05:52 PM
тАО08-27-2008 05:52 PM
Re: Why perl script always fails in crontab ?
I need to run this script through crontab :
#!/opt/perl/bin/perl
#
# Use SAP BR*TOOLS to reorganize indexes in SAP database
#
# save the name of index with poor storage quality into a file
$sql = "/oracle/DEV/920_64/bin/sqlplus sapdev/password \@/oracle/DEV/genrebidx2.sql";
$result = system($sql);
........
........
ORACLE_HOME fail
Case 1
export ORACLE_HOME=/oracle/DEV/920_64;
Bareword found where operator expected at /oracle/DEV/idx_rebuild.sh line 7, near "/oracle/DEV"
(Missing operator before DEV?)
syntax error at /oracle/DEV/idx_rebuild.sh line 7, near "/oracle/DEV"
Execution of /oracle/DEV/idx_rebuild.sh aborted due to compilation errors.
Case 2
$cmd="ORACLE_HOME=/oracle/DEV/920_64";
$result=system($cmd);
Error 6 initializing SQL*Plus
Message file sp1
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
Case 3
export ORACLE_HOME="/oracle/DEV/920_64";
Can't locate object method "export" via package "ORACLE_HOME" (perhaps you forgot to load "ORACLE_HOME"?) at /oracle/DEV/idx_rebuild.sh line 7.
Any ideal ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 11:36 PM
тАО08-27-2008 11:36 PM
Re: Why perl script always fails in crontab ?
This is where you would set the environment in a Perl program.
e.g.
BEGIN {
$ENV{ORACLE_HOME} = '/app/oracle/product/10.2.0';
$ENV{ORACLE_SID} = 'Something According to your tnsnames.ora';
}
Besides, running sqlplus in a system() call
isn't the best way to talk to your Oracle.
The common way in Perl was to "use DBI;".
This of course requires that you have DBD::Oracle installed in your Perl,
which under HP-UX can admittedly be a bit tricky (or ot at least used to be in the past).
Most of all it requires a perl built with following two leading libswanted:
$ perl -V:config_args
config_args='-Duselargefiles -Duse64bitall -A prepend:libswanted=cl pthread ';
But today this is all explained very detailed in the README.hpux that accompanies the DBD-Oracle*.tar.gz which you get from CPAN.
I suggest you check if your perl build meets this requirement using above perl -V invocation or this one
$ perl -V:libswanted
libswanted='cl pthread sfio socket bind inet nsl nm ndbm gdbm db malloc dl dld sun m crypt sec util c cposix posix ucb bsd';
Remember, that "cl pthread " must be leading the list of libs otherwise you will suffer.
Then open your CPAN shell as root,
install DBI and download DBD::Oracle
# perl -MCPAN -e shell
CPAN> install DBI
.
. # lots of output
.
CPAN> get DBD::Oracle
Now to install the DBD::Oracle module you should by all means first successfully run all tests of the module,
which requires careful preparation of your environment beforehand.
That's why I didn't suggest to simply issue
"install DBD::Oracle" above, as this usually fails.
So after the download of DBD::Oracle was successful you need to switch to the shell and prepare and run the test by manual invocation.
Do a
CPAN> look DBD::Oracle
This should have given you a shell and put you in the build directory of DBD::Oracle
Now please, *do* read the POD carefully before continuing because as said it is all outlined in it.
# perldoc README
and even more important
# perldoc README.hpux
or
# perldoc README.hpux.txt
if the README's name has changed to the latter.
If you fail to start perldoc for whatever reason you can also simply load the READMEs
into your favorite pager (like more).
Don't be put off by the strange POD markup then (viz. lines starting with an equals sign in the first column)
Then follow exactly the necessary steps mentioned in the POD.
After having installed DBD::Oracle successfully go on to read the PODs of
DBD::Oracle (mainly the section on how to connect) and DBI (for all the rest).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 11:57 PM
тАО08-27-2008 11:57 PM
Re: Why perl script always fails in crontab ?
I just fixed my problem with :
#!/opt/perl/bin/perl
#
# Use SAP BR*TOOLS to reorganize indexes in SAP database
#
#
$ENV{"ORACLE_HOME"}="/oracle/DEV/920_64";
$ENV{"ORACLE_SID"}="DEV";
$ENV{"PATH"}="/oracle/DEV/920_64/bin:/sapmnt/DEV/exe";
It works.
But there were other errors occurred.
SAP errors.
I will fix them by searching some SAP sites.
Thank you very much.