<?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: Run crontab job in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001592#M297301</link>
    <description>thx all,&lt;BR /&gt;&lt;BR /&gt;What I hope now is when when run a script by crontab , the env will change to env_cron( see below ) , I don't know why this program is not work , can anyone advise what is wrong ? thx &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;for i in $(cat /tmp/env_cron)&lt;BR /&gt;do&lt;BR /&gt;export ${i}&lt;BR /&gt;done</description>
    <pubDate>Fri, 18 May 2007 04:50:51 GMT</pubDate>
    <dc:creator>hangyu</dc:creator>
    <dc:date>2007-05-18T04:50:51Z</dc:date>
    <item>
      <title>Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001567#M297276</link>
      <description>I hv a crontab job (script) that can be run normally , now I try to run it on the shell but can't be run , can advise what is difference between run a script on crontab and run it manually ? is it the difference of system enviornment ?thx</description>
      <pubDate>Wed, 16 May 2007 20:23:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001567#M297276</guid>
      <dc:creator>hangyu</dc:creator>
      <dc:date>2007-05-16T20:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001568#M297277</link>
      <description>This is a very common problem. The environment of cron is intentionally very sparse and cron does not source the user's .profile (nor should it). The solution is rather simple: explicitly set and possibly export any needed environment variables (especially PATH) inside your cron'ed script.</description>
      <pubDate>Wed, 16 May 2007 20:30:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001568#M297277</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-05-16T20:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001569#M297278</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;This kind of problem is usually the otherway around. As in within the Shell you can run the script fine, but fails in Cron.&lt;BR /&gt;&lt;BR /&gt;Since its failing in the shell, execute 'set -x' (assuming you're run Bourne/Korn) then run the script. This should show you when the problem is or the last command that failed.&lt;BR /&gt;&lt;BR /&gt;Jov</description>
      <pubDate>Wed, 16 May 2007 20:44:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001569#M297278</guid>
      <dc:creator>Jov</dc:creator>
      <dc:date>2007-05-16T20:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001570#M297279</link>
      <description>Oh, I may have misread your problem (although it's still not quite clear). Almost certainly if the script runs under cron but not from an interactive shell then the problem is permissions. Are you running as the same user as the cron'ed version? Is the execute bit set on this file for the user that you are running as? Your script could also be testing to see if stdin is a tty device but that would be unlikely. Add set -x and you should immediately see your problem.</description>
      <pubDate>Wed, 16 May 2007 20:52:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001570#M297279</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-05-16T20:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001571#M297280</link>
      <description>thx replies,&lt;BR /&gt;&lt;BR /&gt;I hv two more questions &lt;BR /&gt;&lt;BR /&gt;1. as A.Clay said , how can I "export any needed environment" ? how can I know all my environment ? &lt;BR /&gt;&lt;BR /&gt;2. As A.Clay said , when login with the batch user , it will run the .profile and global profile ( I have set it for my application ) . Is it possible when I run it on shell , the enviornment change to the same as run it by crontab ? thx</description>
      <pubDate>Wed, 16 May 2007 21:02:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001571#M297280</guid>
      <dc:creator>hangyu</dc:creator>
      <dc:date>2007-05-16T21:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001572#M297281</link>
      <description>The "env" command will list all your environment variables.&lt;BR /&gt;&lt;BR /&gt;It's a little difficult to understand your problem. &lt;BR /&gt;&lt;BR /&gt;Answer this very precisely. If you run your script from the shell (NOT FROM CRON), does the script execute properly? Yes or No?</description>
      <pubDate>Wed, 16 May 2007 21:11:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001572#M297281</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-05-16T21:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001573#M297282</link>
      <description>No , it is NOT properly run.&lt;BR /&gt;&lt;BR /&gt;thx&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 16 May 2007 21:25:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001573#M297282</guid>
      <dc:creator>hangyu</dc:creator>
      <dc:date>2007-05-16T21:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001574#M297283</link>
      <description>Ok, in that case the environment set by your .profile or the fact that stdin, stdout, and/or stderr are terminal devices is somehow altering the behavior OR as this user you simply don't have sufficient permissions.&lt;BR /&gt;&lt;BR /&gt;Add set -x near the top of your script and try to run it. You should see exactly what is wrong.</description>
      <pubDate>Wed, 16 May 2007 21:59:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001574#M297283</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-05-16T21:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001575#M297284</link>
      <description>thx reply ,&lt;BR /&gt;&lt;BR /&gt;I tried to run "set -x" on shell , but no any output , what is the function of this command ? &lt;BR /&gt;&lt;BR /&gt;ps. I use bash.</description>
      <pubDate>Wed, 16 May 2007 22:14:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001575#M297284</guid>
      <dc:creator>hangyu</dc:creator>
      <dc:date>2007-05-16T22:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001576#M297285</link>
      <description>&amp;gt;I tried to run "set -x" on shell, but no any output, what is the function of this command?&lt;BR /&gt;&lt;BR /&gt;In a real shell, set -x will list to seterr the commands as it executes them.  See ksh(1) or sh(1).&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I use bash.&lt;BR /&gt;&lt;BR /&gt;Change your shell to sh or ksh?  At least until you get it working.</description>
      <pubDate>Wed, 16 May 2007 22:45:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001576#M297285</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-05-16T22:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001577#M297286</link>
      <description>Let it be known that I am not a real big fan of bash.&lt;BR /&gt;&lt;BR /&gt;Here's one reason:&lt;BR /&gt;echo "One Two Three" | read A B C&lt;BR /&gt;echo "A = ${A} B = ${B} C = ${C}"&lt;BR /&gt;&lt;BR /&gt;That works on the POSIX shell and most Korn shell implementations; it fails on most bash implementations. We can argue about the proper handling of lvalues and subprocess but the above construct is very useful.&lt;BR /&gt;&lt;BR /&gt;Now, is this an HP-UX question or a Linux question?&lt;BR /&gt;</description>
      <pubDate>Wed, 16 May 2007 22:59:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001577#M297286</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-05-16T22:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001578#M297287</link>
      <description>thx reply ,&lt;BR /&gt;&lt;BR /&gt;I have a bit confuse ,&lt;BR /&gt;&lt;BR /&gt;do you mean I should change it to ksh to test it , add "set -x" to my script and try to run it on shell to see any error message ? thx</description>
      <pubDate>Wed, 16 May 2007 23:04:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001578#M297287</guid>
      <dc:creator>hangyu</dc:creator>
      <dc:date>2007-05-16T23:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001579#M297288</link>
      <description>First, is this an HP-UX issue or or some other OS? That helps to define the problem.&lt;BR /&gt;&lt;BR /&gt;Secondly, I don't care what shell YOU use; that's your choice but you should at least know how to enable debugging mode for whatever shell you do use. All I am saying is that contrary to world opinion bash may not be the world's best shell. For example, on Linux, I use the zsh when possible. Moreover, it is very possible that the problem you are describing is a direct consequence of running under different shells when under cron and when in an interactive environment.</description>
      <pubDate>Wed, 16 May 2007 23:13:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001579#M297288</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-05-16T23:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001580#M297289</link>
      <description>&amp;gt;do you mean I should change it to ksh to test it , add "set -x" to my script and try to run it on shell to see any error message?&lt;BR /&gt;&lt;BR /&gt;Well, as Clay says, you shouldn't use bash at all.  ;-)&lt;BR /&gt;&lt;BR /&gt;First you need to look at your bash documentation and see if it supports a set -x like option will enable tracing of script executation.&lt;BR /&gt;&lt;BR /&gt;From my 3.0 bash man page, set -x does do what a real shell says it should.  So this means if you don't get any output, we have to address this.&lt;BR /&gt;&lt;BR /&gt;(You can test this by adding "set -x" to a simple bash script and then see of the rest of the commands in the script get echoed.)&lt;BR /&gt;&lt;BR /&gt;For a real shell, you can also add the -x on the first line:&lt;BR /&gt;#!/usr/bin/sh -x&lt;BR /&gt;Or:&lt;BR /&gt;#!/usr/bin/bash -x&lt;BR /&gt;(Whatever your bash path is.)&lt;BR /&gt;&lt;BR /&gt;Try that for your bash script.&lt;BR /&gt;First try adding -x, then try changing the shell.</description>
      <pubDate>Wed, 16 May 2007 23:16:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001580#M297289</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-05-16T23:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001581#M297290</link>
      <description>&lt;!--!*#--&gt;hi,&lt;BR /&gt;&lt;BR /&gt;one dirty way to do this is to create a crontab entry that runs the job as if you ran it manually.&lt;BR /&gt;&lt;BR /&gt;this should look something like this:&lt;BR /&gt;&lt;BR /&gt;#*******************************************************************************&lt;BR /&gt;&lt;BR /&gt;12 18 *  *   * echo "/path/scripts/myscript.sh; exit"|su - yogeeraj 1&amp;gt;/home/yogeeraj/logfiles/output.crn 2&amp;gt;/home/yogeeraj/logfiles/error.crn&lt;BR /&gt;&lt;BR /&gt;#*******************************************************************************&lt;BR /&gt;# END OF TABLE           day0-&amp;gt;Sunday  day6-&amp;gt;Saturday&lt;BR /&gt;#*******************************************************************************&lt;BR /&gt;  &lt;BR /&gt;&lt;BR /&gt;hope this helps!&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj</description>
      <pubDate>Wed, 16 May 2007 23:47:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001581#M297290</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2007-05-16T23:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001582#M297291</link>
      <description>thx reply ,&lt;BR /&gt;&lt;BR /&gt;I am checking how to use "set -x" , I think the function of this command is to debug  error. Except this method , is there other simply way to make the environment ( run by manually ) to the same as run by crontab ? thx</description>
      <pubDate>Thu, 17 May 2007 03:35:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001582#M297291</guid>
      <dc:creator>hangyu</dc:creator>
      <dc:date>2007-05-17T03:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001583#M297292</link>
      <description>&amp;gt;is there other simply way to make the environment (run by manually) to the same as run by crontab?&lt;BR /&gt;&lt;BR /&gt;Nobody would EVER want to do that except to debug a bad crontab entry.  This was mentioned by Clay and Jov.&lt;BR /&gt;&lt;BR /&gt;To do this, you would have to remove ENV vars and limit the PATH to what crontab(1) says.&lt;BR /&gt;&lt;BR /&gt;And as Clay mentioned, if you have functions that work only on tty devices, you need to exclude those.</description>
      <pubDate>Thu, 17 May 2007 04:05:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001583#M297292</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-05-17T04:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001584#M297293</link>
      <description>thx reply ,&lt;BR /&gt;&lt;BR /&gt;The below is user's env  after login. &lt;BR /&gt;&lt;BR /&gt;MANPATH=/usr/share/man:/usr/local/man&lt;BR /&gt;src=/ora_usr/src&lt;BR /&gt;HOSTNAME=ora&lt;BR /&gt;&lt;BR /&gt;Now , if I want all schedule job ( crontab ) also has this env , what can I do ? thx</description>
      <pubDate>Thu, 17 May 2007 22:22:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001584#M297293</guid>
      <dc:creator>hangyu</dc:creator>
      <dc:date>2007-05-17T22:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001585#M297294</link>
      <description>Add them to the start of the script. If its a command then you'll need to wrapper it within a script. &lt;BR /&gt;&lt;BR /&gt;But why you need to do this? Removing things tend to break crontabs not fix them.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Jov&lt;BR /&gt;</description>
      <pubDate>Thu, 17 May 2007 22:49:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001585#M297294</guid>
      <dc:creator>Jov</dc:creator>
      <dc:date>2007-05-17T22:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: Run crontab job</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001586#M297295</link>
      <description>thx reply , &lt;BR /&gt;&lt;BR /&gt;Add them to the start of the script. If its a command then you'll need to wrapper it within a script -- &amp;gt; can advise how can I wrapper it within a script ?&lt;BR /&gt;&lt;BR /&gt;But why you need to do this? Removing things tend to break crontabs not fix them.&lt;BR /&gt;&lt;BR /&gt;--&amp;gt; I guess it is the simplest way to fix it , I know it will "break crontabs" , do you think it is harmful to the system ? thx</description>
      <pubDate>Fri, 18 May 2007 00:11:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/run-crontab-job/m-p/4001586#M297295</guid>
      <dc:creator>hangyu</dc:creator>
      <dc:date>2007-05-18T00:11:19Z</dc:date>
    </item>
  </channel>
</rss>

