<?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: Executing script through cron in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-script-through-cron/m-p/5260406#M659440</link>
    <description>This normally has to do with the shell enviroment, and missing paths to commands(that you have in your PATH variable via .profile)  when cron executes the script.&lt;BR /&gt;&lt;BR /&gt;Try and give absolute paths to commands not in standard bin directories&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 27 Oct 2010 07:16:04 GMT</pubDate>
    <dc:creator>likid0</dc:creator>
    <dc:date>2010-10-27T07:16:04Z</dc:date>
    <item>
      <title>Executing script through cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-script-through-cron/m-p/5260402#M659436</link>
      <description>I have a script that works fine and sends the required output via mail when i run it manually; however, when I put it in cron, it gets executed at the said time but does not run fine. I guess, it is an issue with the shell that we define at the first line in the script.&lt;BR /&gt;I had faced a similar issue on one server. When i added "/usr/bin/sh &lt;ABSOLUE path="" of="" script=""&gt;&lt;/ABSOLUE&gt;How do I eliminate this issue in the script?  &lt;BR /&gt;</description>
      <pubDate>Wed, 27 Oct 2010 06:42:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-script-through-cron/m-p/5260402#M659436</guid>
      <dc:creator>shrady</dc:creator>
      <dc:date>2010-10-27T06:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: Executing script through cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-script-through-cron/m-p/5260403#M659437</link>
      <description>Hi &lt;BR /&gt;Try adding the below line to your script and see if it works..&lt;BR /&gt;#!/usr/bin/sh to your script.&lt;BR /&gt;&lt;BR /&gt;Sagar</description>
      <pubDate>Wed, 27 Oct 2010 07:01:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-script-through-cron/m-p/5260403#M659437</guid>
      <dc:creator>Sagar Sirdesai</dc:creator>
      <dc:date>2010-10-27T07:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: Executing script through cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-script-through-cron/m-p/5260404#M659438</link>
      <description>Thanks Sagar, please see the second paragraph of the query:&lt;BR /&gt;"I had faced a similar issue on one server. When i added "/usr/bin/sh &lt;ABSOLUE path="" of="" script=""&gt;&lt;/ABSOLUE&gt;&lt;BR /&gt;I have tried this :(</description>
      <pubDate>Wed, 27 Oct 2010 07:04:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-script-through-cron/m-p/5260404#M659438</guid>
      <dc:creator>shrady</dc:creator>
      <dc:date>2010-10-27T07:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: Executing script through cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-script-through-cron/m-p/5260405#M659439</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;My advice is to add the she-bang #!/usr/sbin/sh to your script...&lt;BR /&gt;&lt;BR /&gt;Please ignore if it is already tried...</description>
      <pubDate>Wed, 27 Oct 2010 07:09:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-script-through-cron/m-p/5260405#M659439</guid>
      <dc:creator>Sagar Sirdesai</dc:creator>
      <dc:date>2010-10-27T07:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: Executing script through cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-script-through-cron/m-p/5260406#M659440</link>
      <description>This normally has to do with the shell enviroment, and missing paths to commands(that you have in your PATH variable via .profile)  when cron executes the script.&lt;BR /&gt;&lt;BR /&gt;Try and give absolute paths to commands not in standard bin directories&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Oct 2010 07:16:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-script-through-cron/m-p/5260406#M659440</guid>
      <dc:creator>likid0</dc:creator>
      <dc:date>2010-10-27T07:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Executing script through cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-script-through-cron/m-p/5260407#M659441</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;If you examine the 'crontask(1)' manpages you will see that the environment that 'cron' provides is very sparse.  Specifically the following are set:&lt;BR /&gt;&lt;BR /&gt;HOME=userâ  s-home-directory&lt;BR /&gt;LOGNAME=userâ  s-login-id&lt;BR /&gt;PATH=/usr/bin:/usr/sbin:.&lt;BR /&gt;SHELL=/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;This means that environmental variables that you have specified in your login profile don't exist either, by default, since the login profile is not read.&lt;BR /&gt;&lt;BR /&gt;If you profile contains the necessary environmental variables, you can "source" (read) that as the first step of your crontask. A common problem with using the profile, however, is that the standand HP-UX '${HOME}/.profile' contains terminal interactive commands like 'stty' and 'tset'. Since a cron'ed task isn't interactive (associated with a terminal) unless you condition-out this profile code, you get messages of "Not a typewritter" when you cron your task.&lt;BR /&gt;&lt;BR /&gt;A very clean way to handle environmental variables that you want to use in scripts, is to create a separate file of them that you can be "sourced" (read) whenever necessary. By example, you could do:&lt;BR /&gt;&lt;BR /&gt;# cat /home/shrady/env&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;export PATH=$PATH:/home/shrady/scripts&lt;BR /&gt;export SHLIB_PATH=/home/shrady/1981&lt;BR /&gt;export TZ=UTC&lt;BR /&gt;&lt;BR /&gt;The interpreter line (the "she-bang") is optional for files that will be sourced.  My personal preference is to declare it as a form of documentation at-first-glance.&lt;BR /&gt;&lt;BR /&gt;To use this, do:&lt;BR /&gt;&lt;BR /&gt;. /home/shrady/env&lt;BR /&gt;&lt;BR /&gt;...Note the dot character (".") followed by a space (blank) followed the absolute path of the file you want to read "into" your script. This is what is called "sourcing" a file.&lt;BR /&gt;&lt;BR /&gt;# . /home/shrady/env; /home/shrady/scripts/mything&lt;BR /&gt;&lt;BR /&gt;...or in a crontab:&lt;BR /&gt;&lt;BR /&gt;1 * * * * ./home/shrady/env;/home/shrady/scripts/mything&lt;BR /&gt;&lt;BR /&gt;The file of your variables can also be sourced at the end of your login profile too. Thus, only ONE copy of variables needs to be maintained.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 27 Oct 2010 09:21:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-script-through-cron/m-p/5260407#M659441</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-10-27T09:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: Executing script through cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-script-through-cron/m-p/5260408#M659442</link>
      <description>&amp;gt;it is an issue with the shell that we define at the first line in the script.&lt;BR /&gt;&lt;BR /&gt;It shouldn't be.  If you use #! shell, then sh will execute that shell.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;When I added "/usr/bin/sh &lt;ABSOLUTE path="" of="" script=""&gt;&lt;/ABSOLUTE&gt;&lt;BR /&gt;You shouldn't have to do that since cron is going to use sh anyway.  Unless your script isn't executable?</description>
      <pubDate>Wed, 27 Oct 2010 10:17:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-script-through-cron/m-p/5260408#M659442</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-10-27T10:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: Executing script through cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-script-through-cron/m-p/5260409#M659443</link>
      <description>Thanks James! Issue solved after setting proper env</description>
      <pubDate>Wed, 27 Oct 2010 10:59:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-script-through-cron/m-p/5260409#M659443</guid>
      <dc:creator>shrady</dc:creator>
      <dc:date>2010-10-27T10:59:25Z</dc:date>
    </item>
  </channel>
</rss>

