<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Why perl script always fails in crontab ? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258706#M332633</link>
    <description>Haven't you heard about Perl's %ENV hash?&lt;BR /&gt;This is where you would set the environment in a Perl program.&lt;BR /&gt;e.g.&lt;BR /&gt;&lt;BR /&gt;BEGIN { &lt;BR /&gt;        $ENV{ORACLE_HOME} = '/app/oracle/product/10.2.0';&lt;BR /&gt;        $ENV{ORACLE_SID} = 'Something According to your tnsnames.ora';&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Besides, running sqlplus in a system() call&lt;BR /&gt;isn't the best way to talk to your Oracle.&lt;BR /&gt;The common way in Perl was to "use DBI;".&lt;BR /&gt;This of course requires that you have DBD::Oracle installed in your Perl,&lt;BR /&gt;which under HP-UX can admittedly be a bit tricky (or ot at least used to be in the past).&lt;BR /&gt;Most of all it requires a perl built with following two leading libswanted:&lt;BR /&gt;&lt;BR /&gt;$ perl -V:config_args         &lt;BR /&gt;config_args='-Duselargefiles -Duse64bitall -A prepend:libswanted=cl pthread ';&lt;BR /&gt;&lt;BR /&gt;But today this is all explained very detailed in the README.hpux that accompanies the DBD-Oracle*.tar.gz which you get from CPAN.&lt;BR /&gt;&lt;BR /&gt;I suggest you check if your perl build meets this requirement using above perl -V invocation or this one&lt;BR /&gt;&lt;BR /&gt;$ perl -V:libswanted &lt;BR /&gt;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';&lt;BR /&gt;&lt;BR /&gt;Remember, that "cl pthread " must be leading the list of libs otherwise you will suffer.&lt;BR /&gt;&lt;BR /&gt;Then open your CPAN shell as root,&lt;BR /&gt;install DBI and download DBD::Oracle&lt;BR /&gt;&lt;BR /&gt;# perl -MCPAN -e shell&lt;BR /&gt;&lt;BR /&gt;CPAN&amp;gt; install DBI&lt;BR /&gt;  .&lt;BR /&gt;  .  # lots of output&lt;BR /&gt;  .&lt;BR /&gt;CPAN&amp;gt; get DBD::Oracle&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now to install the DBD::Oracle module you should by all means first successfully run all tests of the module,&lt;BR /&gt;which requires careful preparation of your environment beforehand.&lt;BR /&gt;That's why I didn't suggest to simply issue &lt;BR /&gt;"install DBD::Oracle" above, as this usually fails.&lt;BR /&gt;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.&lt;BR /&gt;Do a&lt;BR /&gt;&lt;BR /&gt;CPAN&amp;gt; look DBD::Oracle&lt;BR /&gt;&lt;BR /&gt;This should have given you a shell and put you in the build directory of DBD::Oracle&lt;BR /&gt;Now please, *do* read the POD carefully before continuing because as said it is all outlined in it.&lt;BR /&gt;&lt;BR /&gt;# perldoc README&lt;BR /&gt;&lt;BR /&gt;and even more important&lt;BR /&gt;&lt;BR /&gt;# perldoc README.hpux&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;# perldoc README.hpux.txt&lt;BR /&gt;&lt;BR /&gt;if the README's name has changed to the latter.&lt;BR /&gt;If you fail to start perldoc for whatever reason you can also simply load the READMEs &lt;BR /&gt;into your favorite pager (like more).&lt;BR /&gt;Don't be put off by the strange POD markup then (viz. lines starting with an equals sign in the first column)&lt;BR /&gt;Then follow exactly the necessary steps mentioned in the POD.&lt;BR /&gt;After having installed DBD::Oracle successfully go on to read the PODs of&lt;BR /&gt;DBD::Oracle (mainly the section on how to connect) and DBI (for all the rest).&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 28 Aug 2008 06:36:27 GMT</pubDate>
    <dc:creator>Ralph Grothe</dc:creator>
    <dc:date>2008-08-28T06:36:27Z</dc:date>
    <item>
      <title>Why perl script always fails in crontab ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258697#M332624</link>
      <description>I need to run sqlplus + perl script in crontab in order to rebuild SAP index regularly.&lt;BR /&gt;But I don't know the script fail in crontab but success in command prompt.&lt;BR /&gt;Any ideal ?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Aug 2008 10:04:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258697#M332624</guid>
      <dc:creator>cpchan</dc:creator>
      <dc:date>2008-08-27T10:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Why perl script always fails in crontab ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258698#M332625</link>
      <description>maybe you must source the /etc/.profile in the script</description>
      <pubDate>Wed, 27 Aug 2008 10:23:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258698#M332625</guid>
      <dc:creator>J.G.D. van Zonneveld</dc:creator>
      <dc:date>2008-08-27T10:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: Why perl script always fails in crontab ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258699#M332626</link>
      <description>... or specify the full path to sqlplus.&lt;BR /&gt;&lt;BR /&gt;Anyway, something like "it fails" only is never a good description of a situation.</description>
      <pubDate>Wed, 27 Aug 2008 10:26:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258699#M332626</guid>
      <dc:creator>Torsten.</dc:creator>
      <dc:date>2008-08-27T10:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: Why perl script always fails in crontab ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258700#M332627</link>
      <description>Hi Cpchan,&lt;BR /&gt;&lt;BR /&gt;Check for cron log. the path is &lt;BR /&gt;#/var/adm/cron/log&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Atul</description>
      <pubDate>Wed, 27 Aug 2008 10:39:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258700#M332627</guid>
      <dc:creator>Prashanth Waugh</dc:creator>
      <dc:date>2008-08-27T10:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: Why perl script always fails in crontab ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258701#M332628</link>
      <description>hi cpchan,&lt;BR /&gt;&lt;BR /&gt;pls check #crontab -l ouput and paste it here&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Reagrds&lt;BR /&gt;Atul&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Aug 2008 10:42:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258701#M332628</guid>
      <dc:creator>Prashanth Waugh</dc:creator>
      <dc:date>2008-08-27T10:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why perl script always fails in crontab ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258702#M332629</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;cron has no environment.&lt;BR /&gt;&lt;BR /&gt;Your script needs a PATH variable set or must have all external calls include the full path.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 27 Aug 2008 10:53:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258702#M332629</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2008-08-27T10:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: Why perl script always fails in crontab ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258703#M332630</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;You might be enlightened if you use the 'warnings' pragma (let alone the 'strict' pragma' in your code!&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 27 Aug 2008 11:51:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258703#M332630</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-08-27T11:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Why perl script always fails in crontab ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258704#M332631</link>
      <description>This kind of problem is most of the time resulting of the no environnement execution. When a program is launched from cron, profiles (/etc/profile and .profile) are not sourced, so env variables such as PATH are not loaded. Modify your program to load them or run your program through "su - user -c..." commands.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Fred&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Aug 2008 12:11:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258704#M332631</guid>
      <dc:creator>Fred Ruffet</dc:creator>
      <dc:date>2008-08-27T12:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Why perl script always fails in crontab ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258705#M332632</link>
      <description>Thanks every bodies.&lt;BR /&gt;I need to run this script through crontab :&lt;BR /&gt;&lt;BR /&gt;#!/opt/perl/bin/perl&lt;BR /&gt;#&lt;BR /&gt;# Use SAP BR*TOOLS to reorganize indexes in SAP database&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;&lt;I have="" tried="" many="" different="" ways="" to="" export="" oracle_home=""&gt;&lt;BR /&gt;&lt;BR /&gt;# save the name of index with poor storage quality into a file&lt;BR /&gt;$sql = "/oracle/DEV/920_64/bin/sqlplus sapdev/password \@/oracle/DEV/genrebidx2.sql";&lt;BR /&gt;$result = system($sql);&lt;BR /&gt;........&lt;BR /&gt;........&lt;BR /&gt;&lt;BR /&gt;ORACLE_HOME fail&lt;BR /&gt;Case 1&lt;BR /&gt;export ORACLE_HOME=/oracle/DEV/920_64;&lt;BR /&gt;&lt;BR /&gt;Bareword found where operator expected at /oracle/DEV/idx_rebuild.sh line 7, near "/oracle/DEV"&lt;BR /&gt;        (Missing operator before DEV?)&lt;BR /&gt;syntax error at /oracle/DEV/idx_rebuild.sh line 7, near "/oracle/DEV"&lt;BR /&gt;Execution of /oracle/DEV/idx_rebuild.sh aborted due to compilation errors.&lt;BR /&gt;&lt;BR /&gt;Case 2&lt;BR /&gt;$cmd="ORACLE_HOME=/oracle/DEV/920_64";&lt;BR /&gt;$result=system($cmd);&lt;BR /&gt;&lt;BR /&gt;Error 6 initializing SQL*Plus&lt;BR /&gt;Message file sp1&lt;LANG&gt;.msb not found&lt;BR /&gt;SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory&lt;BR /&gt;&lt;BR /&gt;Case 3&lt;BR /&gt;export ORACLE_HOME="/oracle/DEV/920_64";&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Any ideal ?&lt;/LANG&gt;&lt;/I&gt;</description>
      <pubDate>Thu, 28 Aug 2008 00:52:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258705#M332632</guid>
      <dc:creator>cpchan</dc:creator>
      <dc:date>2008-08-28T00:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: Why perl script always fails in crontab ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258706#M332633</link>
      <description>Haven't you heard about Perl's %ENV hash?&lt;BR /&gt;This is where you would set the environment in a Perl program.&lt;BR /&gt;e.g.&lt;BR /&gt;&lt;BR /&gt;BEGIN { &lt;BR /&gt;        $ENV{ORACLE_HOME} = '/app/oracle/product/10.2.0';&lt;BR /&gt;        $ENV{ORACLE_SID} = 'Something According to your tnsnames.ora';&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Besides, running sqlplus in a system() call&lt;BR /&gt;isn't the best way to talk to your Oracle.&lt;BR /&gt;The common way in Perl was to "use DBI;".&lt;BR /&gt;This of course requires that you have DBD::Oracle installed in your Perl,&lt;BR /&gt;which under HP-UX can admittedly be a bit tricky (or ot at least used to be in the past).&lt;BR /&gt;Most of all it requires a perl built with following two leading libswanted:&lt;BR /&gt;&lt;BR /&gt;$ perl -V:config_args         &lt;BR /&gt;config_args='-Duselargefiles -Duse64bitall -A prepend:libswanted=cl pthread ';&lt;BR /&gt;&lt;BR /&gt;But today this is all explained very detailed in the README.hpux that accompanies the DBD-Oracle*.tar.gz which you get from CPAN.&lt;BR /&gt;&lt;BR /&gt;I suggest you check if your perl build meets this requirement using above perl -V invocation or this one&lt;BR /&gt;&lt;BR /&gt;$ perl -V:libswanted &lt;BR /&gt;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';&lt;BR /&gt;&lt;BR /&gt;Remember, that "cl pthread " must be leading the list of libs otherwise you will suffer.&lt;BR /&gt;&lt;BR /&gt;Then open your CPAN shell as root,&lt;BR /&gt;install DBI and download DBD::Oracle&lt;BR /&gt;&lt;BR /&gt;# perl -MCPAN -e shell&lt;BR /&gt;&lt;BR /&gt;CPAN&amp;gt; install DBI&lt;BR /&gt;  .&lt;BR /&gt;  .  # lots of output&lt;BR /&gt;  .&lt;BR /&gt;CPAN&amp;gt; get DBD::Oracle&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now to install the DBD::Oracle module you should by all means first successfully run all tests of the module,&lt;BR /&gt;which requires careful preparation of your environment beforehand.&lt;BR /&gt;That's why I didn't suggest to simply issue &lt;BR /&gt;"install DBD::Oracle" above, as this usually fails.&lt;BR /&gt;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.&lt;BR /&gt;Do a&lt;BR /&gt;&lt;BR /&gt;CPAN&amp;gt; look DBD::Oracle&lt;BR /&gt;&lt;BR /&gt;This should have given you a shell and put you in the build directory of DBD::Oracle&lt;BR /&gt;Now please, *do* read the POD carefully before continuing because as said it is all outlined in it.&lt;BR /&gt;&lt;BR /&gt;# perldoc README&lt;BR /&gt;&lt;BR /&gt;and even more important&lt;BR /&gt;&lt;BR /&gt;# perldoc README.hpux&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;# perldoc README.hpux.txt&lt;BR /&gt;&lt;BR /&gt;if the README's name has changed to the latter.&lt;BR /&gt;If you fail to start perldoc for whatever reason you can also simply load the READMEs &lt;BR /&gt;into your favorite pager (like more).&lt;BR /&gt;Don't be put off by the strange POD markup then (viz. lines starting with an equals sign in the first column)&lt;BR /&gt;Then follow exactly the necessary steps mentioned in the POD.&lt;BR /&gt;After having installed DBD::Oracle successfully go on to read the PODs of&lt;BR /&gt;DBD::Oracle (mainly the section on how to connect) and DBI (for all the rest).&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Aug 2008 06:36:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258706#M332633</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2008-08-28T06:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Why perl script always fails in crontab ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258707#M332634</link>
      <description>Yes, thanks a lot.&lt;BR /&gt;I just fixed my problem with :&lt;BR /&gt;&lt;BR /&gt;#!/opt/perl/bin/perl&lt;BR /&gt;#&lt;BR /&gt;# Use SAP BR*TOOLS to reorganize indexes in SAP database&lt;BR /&gt;#&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;$ENV{"ORACLE_HOME"}="/oracle/DEV/920_64";&lt;BR /&gt;$ENV{"ORACLE_SID"}="DEV";&lt;BR /&gt;$ENV{"PATH"}="/oracle/DEV/920_64/bin:/sapmnt/DEV/exe";&lt;BR /&gt;&lt;BR /&gt;It works.&lt;BR /&gt;But there were other errors occurred.&lt;BR /&gt;SAP errors.&lt;BR /&gt;I will fix them by searching some SAP sites.&lt;BR /&gt;Thank you very much.</description>
      <pubDate>Thu, 28 Aug 2008 06:57:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-perl-script-always-fails-in-crontab/m-p/4258707#M332634</guid>
      <dc:creator>cpchan</dc:creator>
      <dc:date>2008-08-28T06:57:40Z</dc:date>
    </item>
  </channel>
</rss>

