<?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: Running a Script from cron in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455847#M12447</link>
    <description>Thanks for all the input. After tracing through the script I know the problem is loging into sql. This command works from the prompt.&lt;BR /&gt;sqlplus username/password @/opt/mimsps/mims_sys/local/script_name&lt;BR /&gt;&lt;BR /&gt;In cron I get this error which tells me it must be the environment variables.&lt;BR /&gt;/opt/mimsps/mims_sys/local/usbtest.sh[55]: sqlplus:  not found&lt;BR /&gt;&lt;BR /&gt;Any other suggestions??&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 20 Oct 2000 17:42:27 GMT</pubDate>
    <dc:creator>David McCallum</dc:creator>
    <dc:date>2000-10-20T17:42:27Z</dc:date>
    <item>
      <title>Running a Script from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455841#M12441</link>
      <description>When I run a script from the command line manually it works fine. If I run the same script from cron it does not work. Any suggestions??</description>
      <pubDate>Thu, 19 Oct 2000 21:31:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455841#M12441</guid>
      <dc:creator>David McCallum</dc:creator>
      <dc:date>2000-10-19T21:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Script from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455842#M12442</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;the major common difference between command line (shell from login) and cron is the environment (can be seen with: set)&lt;BR /&gt;So check your script if it depends on environment variables that where not set by cron. Add these variable definitions to your script.&lt;BR /&gt;Another thing is that a process from cron has no input device (not tty assosiation). So getting some dialog input is not available by cron.&lt;BR /&gt;&lt;BR /&gt;Hope this gives you the way.&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Thu, 19 Oct 2000 21:43:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455842#M12442</guid>
      <dc:creator>Andreas Voss</dc:creator>
      <dc:date>2000-10-19T21:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Script from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455843#M12443</link>
      <description>You might want to source any info from your .profile in your cron script</description>
      <pubDate>Thu, 19 Oct 2000 22:09:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455843#M12443</guid>
      <dc:creator>Anthony Goonetilleke</dc:creator>
      <dc:date>2000-10-19T22:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Script from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455844#M12444</link>
      <description>In the most cases in my experience, the reason of script failed using cron is due to invalid path of command.&lt;BR /&gt;Those command you can run smoothly on a shell becase $PATH has been setup on .profile. But it may not use when running scripts via cron. So, I would suggest all command inside the script should key in path. e.g. /etc/fbackup or /etc/vgdisplay.</description>
      <pubDate>Fri, 20 Oct 2000 03:04:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455844#M12444</guid>
      <dc:creator>Mr Anthony Wong</dc:creator>
      <dc:date>2000-10-20T03:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Script from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455845#M12445</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I think the first thing to do is look at you mail. Most of the times, your mail will contain error messages that will show why your script did not run as expected. Most probably, the script cannot find your commands or other env. variables.</description>
      <pubDate>Fri, 20 Oct 2000 10:22:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455845#M12445</guid>
      <dc:creator>Martin M. Adato Jr.</dc:creator>
      <dc:date>2000-10-20T10:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Script from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455846#M12446</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Make sure you are running the correct shell. Cron runs jobs by default with /usr/bin/sh so if you have written and tested a script using your csh or ksh login shell it will not work.&lt;BR /&gt;&lt;BR /&gt;The first line should specify the shell.ie&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;Also, as the other answers have said I find that paths and environment settings are a common problem.&lt;BR /&gt;&lt;BR /&gt;Try redirecting stderr to a file to see what the problem is. eg&lt;BR /&gt;&lt;BR /&gt;/script 2&amp;gt;/error.report&lt;BR /&gt;&lt;BR /&gt;Hope it helps,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Paul.</description>
      <pubDate>Fri, 20 Oct 2000 11:13:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455846#M12446</guid>
      <dc:creator>Paul Davies</dc:creator>
      <dc:date>2000-10-20T11:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Script from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455847#M12447</link>
      <description>Thanks for all the input. After tracing through the script I know the problem is loging into sql. This command works from the prompt.&lt;BR /&gt;sqlplus username/password @/opt/mimsps/mims_sys/local/script_name&lt;BR /&gt;&lt;BR /&gt;In cron I get this error which tells me it must be the environment variables.&lt;BR /&gt;/opt/mimsps/mims_sys/local/usbtest.sh[55]: sqlplus:  not found&lt;BR /&gt;&lt;BR /&gt;Any other suggestions??&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Oct 2000 17:42:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455847#M12447</guid>
      <dc:creator>David McCallum</dc:creator>
      <dc:date>2000-10-20T17:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Script from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455848#M12448</link>
      <description>In your .profile of the user that can run the script (or in /etc/profile) you of course setup your enviroment. Just copy the enviroment setup lines to the top of your script and it should then be able to run in cron. Try to be surgical as to what enviroment you build in the script. Only put in what the script needs.&lt;BR /&gt;&lt;BR /&gt;You may also want to set your shell in the script with the #!/sbin/ksh line or what ever shell you actually need.</description>
      <pubDate>Fri, 20 Oct 2000 18:16:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455848#M12448</guid>
      <dc:creator>Lawrence Mahan</dc:creator>
      <dc:date>2000-10-20T18:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Script from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455849#M12449</link>
      <description>David:&lt;BR /&gt;  Its clearly the problem with the PATH variable not being set.&lt;BR /&gt;Add the following lines to the script begining.&lt;BR /&gt;export PATH=$PATH:$ORACLE_HOME/bin.&lt;BR /&gt;Also ensure to define ORACLE_HOME variable just before the above line in your script according to your environment.&lt;BR /&gt;&lt;BR /&gt;This should make the script work when placed in cron.&lt;BR /&gt;&lt;BR /&gt;......Madhu</description>
      <pubDate>Fri, 20 Oct 2000 18:27:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455849#M12449</guid>
      <dc:creator>Madhu Sudhan_1</dc:creator>
      <dc:date>2000-10-20T18:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Script from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455850#M12450</link>
      <description>The problem is that the shell does not find sqplplus in its PATH.  Either set the PATH ecplicitely or supply an absolute path to sqlplus on the line in the script.</description>
      <pubDate>Fri, 20 Oct 2000 18:32:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455850#M12450</guid>
      <dc:creator>Alan Riggs</dc:creator>
      <dc:date>2000-10-20T18:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Script from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455851#M12451</link>
      <description>Thanks again for the information. I added these lines to the script.&lt;BR /&gt;&lt;BR /&gt;ORACLE_HOME=/oracle/7.3.3&lt;BR /&gt;export PATH=$PATH:$ORACLE_HOME/bin&lt;BR /&gt;&lt;BR /&gt;Now I get this error message.&lt;BR /&gt; &lt;BR /&gt;Message file sp1&lt;LANG&gt;.msb not found.&lt;BR /&gt;Error initializing SQL*Plus&lt;BR /&gt;&lt;BR /&gt;Any last suggestions??&lt;/LANG&gt;</description>
      <pubDate>Fri, 20 Oct 2000 19:01:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455851#M12451</guid>
      <dc:creator>David McCallum</dc:creator>
      <dc:date>2000-10-20T19:01:01Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Script from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455852#M12452</link>
      <description>It appears the sqplus command depends upon something else that is set in your environment.  Rather than knocking each of these issues down one-by-one might I suggest placing:&lt;BR /&gt;&lt;BR /&gt;. /etc/profile&lt;BR /&gt;. /home/&lt;USER_DIR&gt;/.profile&lt;BR /&gt;&lt;BR /&gt;at the beginning of your script.&lt;/USER_DIR&gt;</description>
      <pubDate>Fri, 20 Oct 2000 19:06:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455852#M12452</guid>
      <dc:creator>Alan Riggs</dc:creator>
      <dc:date>2000-10-20T19:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Script from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455853#M12453</link>
      <description>Thanks again for the information. I added these lines to the script.&lt;BR /&gt;&lt;BR /&gt;ORACLE_HOME=/oracle/7.3.3&lt;BR /&gt;export PATH=$PATH:$ORACLE_HOME/bin&lt;BR /&gt;&lt;BR /&gt;Now I get this error message.&lt;BR /&gt; &lt;BR /&gt;Message file sp1&lt;LANG&gt;.msb not found.&lt;BR /&gt;Error initializing SQL*Plus&lt;BR /&gt;&lt;BR /&gt;Any last suggestions??&lt;/LANG&gt;</description>
      <pubDate>Fri, 20 Oct 2000 19:52:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455853#M12453</guid>
      <dc:creator>David McCallum</dc:creator>
      <dc:date>2000-10-20T19:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Script from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455854#M12454</link>
      <description>Add the following path to resolve the problem problem of sqlplus not getting initialised.&lt;BR /&gt;&lt;BR /&gt;As a whole it should look something like the following&lt;BR /&gt;PATH=$PATH:$ORACLE_HOME:/bin:$ORACLE_HOME/sqlplus/mesg &lt;BR /&gt;&lt;BR /&gt;Hope fully this works.&lt;BR /&gt;&lt;BR /&gt;......Madhu</description>
      <pubDate>Fri, 20 Oct 2000 20:33:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455854#M12454</guid>
      <dc:creator>Madhu Sudhan_1</dc:creator>
      <dc:date>2000-10-20T20:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Script from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455855#M12455</link>
      <description>The resolve to my issue was to run the script from the root cron and then su to the user environment to run the script&lt;BR /&gt;&lt;BR /&gt;crontab entry:&lt;BR /&gt;&lt;BR /&gt;00 5 5 * * /usr/bin/su - username -c "script"&lt;BR /&gt;&lt;BR /&gt;Thanks to all those who gave answers in this matter.&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Nov 2000 20:58:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455855#M12455</guid>
      <dc:creator>David McCallum</dc:creator>
      <dc:date>2000-11-09T20:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Script from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455856#M12456</link>
      <description>I had this same problem with executing an sql script from an automatic action in OVO.  To solve it I added the following lines to my script.&lt;BR /&gt;&lt;BR /&gt;export ORACLE_HOME=&lt;YOUR oracle="" home="" path="" here=""&gt;&lt;BR /&gt;export ORACLE_SID=openview&lt;BR /&gt;export PATH=$ORACLE_HOME/bin:$PATH&lt;BR /&gt;export ORAENV_ASK=NO&lt;BR /&gt;. oraenv&lt;BR /&gt;&lt;BR /&gt;And now it works.&lt;/YOUR&gt;</description>
      <pubDate>Thu, 28 Aug 2003 16:27:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455856#M12456</guid>
      <dc:creator>Kelly Wiebe</dc:creator>
      <dc:date>2003-08-28T16:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: Running a Script from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455857#M12457</link>
      <description>If you're using Oracle, you must declare exactly the environment variables that are present on your default Oracle user environment.&lt;BR /&gt;&lt;BR /&gt;The easiest way to do this is to include the line &lt;BR /&gt;&lt;BR /&gt;. ~orauser/.profile (or . &lt;PATH_TO_ORACLE_PROFILE&gt;) in your script. A colleague had the same problem here yesterday and this has solved the issue.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;Paulo Fessel&lt;/PATH_TO_ORACLE_PROFILE&gt;</description>
      <pubDate>Thu, 28 Aug 2003 21:19:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/running-a-script-from-cron/m-p/2455857#M12457</guid>
      <dc:creator>Paulo A G Fessel</dc:creator>
      <dc:date>2003-08-28T21:19:17Z</dc:date>
    </item>
  </channel>
</rss>

