<?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: cron causes script to fail in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597607#M232373</link>
    <description>when the script is run from command line, the user has executed an oracle env setup which is not run when the script is run from cron.</description>
    <pubDate>Fri, 05 Aug 2005 13:21:49 GMT</pubDate>
    <dc:creator>Alan Meyer_4</dc:creator>
    <dc:date>2005-08-05T13:21:49Z</dc:date>
    <item>
      <title>cron causes script to fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597606#M232372</link>
      <description>one of my dbas has a script that runs fine from the command line, but fails when run by cron&lt;BR /&gt;Here is the script:&lt;BR /&gt;&lt;BR /&gt;oracle@luna:default:o cat exp.ksh&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;export ORACLE_SID=EBPROD&lt;BR /&gt;cd /ora_backup&lt;BR /&gt;rm  exp_EBPROD.dmp.gz&lt;BR /&gt;mknod node1 p&lt;BR /&gt;gzip &amp;lt; node1 &amp;gt; exp_EBPROD.dmp.gz &amp;amp;&lt;BR /&gt;exp / file=node1 buffer=50000000 log=/ora_backup/exp_EBPROD.log statistics=none full=y grants=none indexes=y compress=none constraints=y direct=y&lt;BR /&gt;rm -f pipe.file&lt;BR /&gt;&lt;BR /&gt;Basically, it sets up a pipe, dumps the export to the pipe, where it is picked up by gzip and output to a file&lt;BR /&gt;&lt;BR /&gt;here is the crontab entry&lt;BR /&gt;59 10 * * * /bin/ksh -c '. $HOME/.profile; cd /ora_backup; /ora_backup/exp.ksh;'&lt;BR /&gt;&lt;BR /&gt;here is the pertinent error from Oracle:&lt;BR /&gt;EXP-00002: error in writing to export fileerror closing export file node1&lt;BR /&gt;EXP-00000: Export terminated unsuccessfully&lt;BR /&gt;&lt;BR /&gt;It lloks to me like oracle is unable to write to the pipe. And yet, it is able to do so when the script is run from the command line.&lt;BR /&gt;&lt;BR /&gt;Any suggestions?&lt;BR /&gt;&lt;BR /&gt;Dan Baker</description>
      <pubDate>Fri, 05 Aug 2005 13:15:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597606#M232372</guid>
      <dc:creator>Dan Baker_3</dc:creator>
      <dc:date>2005-08-05T13:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: cron causes script to fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597607#M232373</link>
      <description>when the script is run from command line, the user has executed an oracle env setup which is not run when the script is run from cron.</description>
      <pubDate>Fri, 05 Aug 2005 13:21:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597607#M232373</guid>
      <dc:creator>Alan Meyer_4</dc:creator>
      <dc:date>2005-08-05T13:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: cron causes script to fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597608#M232374</link>
      <description>How is that? He is running his profile in the crontab entry.</description>
      <pubDate>Fri, 05 Aug 2005 13:23:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597608#M232374</guid>
      <dc:creator>Dan Baker_3</dc:creator>
      <dc:date>2005-08-05T13:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: cron causes script to fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597609#M232375</link>
      <description>Cron has a very limited set of environmental variables available to it.  You need to make sure that any variables, including path are set explicitly in your script.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 05 Aug 2005 13:24:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597609#M232375</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2005-08-05T13:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: cron causes script to fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597610#M232376</link>
      <description>Or use full path names for all commands.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 05 Aug 2005 13:25:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597610#M232376</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2005-08-05T13:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: cron causes script to fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597611#M232377</link>
      <description>the cron job does not execute the login profile for roacle when it executes the job.  you need to include a line similiar to &lt;BR /&gt;&lt;BR /&gt;. /home/oracle/.profile&lt;BR /&gt;&lt;BR /&gt;at the beginning of the job to include the oracle environment.</description>
      <pubDate>Fri, 05 Aug 2005 13:29:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597611#M232377</guid>
      <dc:creator>Alan Meyer_4</dc:creator>
      <dc:date>2005-08-05T13:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: cron causes script to fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597612#M232378</link>
      <description>Put a + sign in the top of the script and run some tests.&lt;BR /&gt;&lt;BR /&gt;I suspect that Pete is right in that the only changes from cron to command line tend to be the environment variables.&lt;BR /&gt;&lt;BR /&gt;If you have not set all the same environment variables to run or the full path names are not used, its quite possible that certain files arent being found.&lt;BR /&gt;</description>
      <pubDate>Fri, 05 Aug 2005 13:30:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597612#M232378</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2005-08-05T13:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: cron causes script to fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597613#M232379</link>
      <description>Well,the crontab entry clearly loads the profile, but just to make sure, I added this line to the beginning of the script:&lt;BR /&gt;&lt;BR /&gt;. /oravl01/oracle/.profile&lt;BR /&gt;&lt;BR /&gt;Still no dice. Anyting else?</description>
      <pubDate>Fri, 05 Aug 2005 13:46:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597613#M232379</guid>
      <dc:creator>Dan Baker_3</dc:creator>
      <dc:date>2005-08-05T13:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: cron causes script to fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597614#M232380</link>
      <description>I tested it some myself and retract the suggestions about the user env, but I agree with Pete about the limited amount of system environmental and path availability.  Test out the script with the + like Kent said or put in some print/echo statements to check the availability of the pipe...</description>
      <pubDate>Fri, 05 Aug 2005 13:49:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597614#M232380</guid>
      <dc:creator>Alan Meyer_4</dc:creator>
      <dc:date>2005-08-05T13:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: cron causes script to fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597615#M232381</link>
      <description>(cont) because the system /etc/profile does not get executed by cron</description>
      <pubDate>Fri, 05 Aug 2005 13:54:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597615#M232381</guid>
      <dc:creator>Alan Meyer_4</dc:creator>
      <dc:date>2005-08-05T13:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: cron causes script to fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597616#M232382</link>
      <description>I suspect that what is wrong are the permissions on the pipe because the default mode is 666 but that is modified by umask which is not the same under cron. Add a chmod 666 node1 after the mknod. Also make sure that gzip starts by specifying a full pathname.&lt;BR /&gt;&lt;BR /&gt;Sourcing oracles .profile is also problematic because it probably has commands like tset, stty, tabs ... which expect stdin to be a tty device. Surround all of those in .profile with&lt;BR /&gt;if [[ -t 0 ]]&lt;BR /&gt;  then&lt;BR /&gt;    tput ..&lt;BR /&gt;    stty ..&lt;BR /&gt;  fi&lt;BR /&gt;</description>
      <pubDate>Fri, 05 Aug 2005 13:57:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597616#M232382</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-08-05T13:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: cron causes script to fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597617#M232383</link>
      <description>either sourcing the /etc/prfile or adding the chmod command fixed the problem. Thanks, guys!</description>
      <pubDate>Fri, 05 Aug 2005 14:10:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597617#M232383</guid>
      <dc:creator>Dan Baker_3</dc:creator>
      <dc:date>2005-08-05T14:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: cron causes script to fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597618#M232384</link>
      <description>Hey, you might want to think of giving the other guys points too, they put in a lot of effort too...</description>
      <pubDate>Fri, 05 Aug 2005 14:12:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-causes-script-to-fail/m-p/3597618#M232384</guid>
      <dc:creator>Alan Meyer_4</dc:creator>
      <dc:date>2005-08-05T14:12:48Z</dc:date>
    </item>
  </channel>
</rss>

