<?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: Script Execution Unable to Log When Executed Via Cron in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562585#M371850</link>
    <description>hi &lt;BR /&gt;&lt;BR /&gt;can you please sahre the O/ps of the job as run maunally as well as the error that you get while executing the job as with cron.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;the cron logs you can find at /var/adm/cron/log file.&lt;BR /&gt;&lt;BR /&gt;please share as well the O/p of the  command&lt;BR /&gt;&lt;BR /&gt;crontab -e as run as root&lt;BR /&gt;&lt;BR /&gt;regards</description>
    <pubDate>Tue, 12 Jan 2010 08:57:28 GMT</pubDate>
    <dc:creator>sujit kumar singh</dc:creator>
    <dc:date>2010-01-12T08:57:28Z</dc:date>
    <item>
      <title>Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562584#M371849</link>
      <description>I have a number of scripts that when executed manually logs everything on how it executes step by step. Problem is when these scripts are ran via cron logging is not complete.&lt;BR /&gt;&lt;BR /&gt;Did some minor troubleshooting:&lt;BR /&gt;1. Checked the user that executes the job if he is a member of the cron.allow file.&lt;BR /&gt;2. Checked Directory Permissions&lt;BR /&gt;3. Changed the default shell of the user from /usr/bin/sh to /sbin/sh&lt;BR /&gt;4. Placed an ampersand "&amp;amp;" at the end of the script in crontab (e.g.:  * * * * * /dir/script.sh &amp;amp;)&lt;BR /&gt;&lt;BR /&gt;But to no avail. What seems to be the problem with cron?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;TIA</description>
      <pubDate>Tue, 12 Jan 2010 08:37:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562584#M371849</guid>
      <dc:creator>sysad_boy</dc:creator>
      <dc:date>2010-01-12T08:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562585#M371850</link>
      <description>hi &lt;BR /&gt;&lt;BR /&gt;can you please sahre the O/ps of the job as run maunally as well as the error that you get while executing the job as with cron.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;the cron logs you can find at /var/adm/cron/log file.&lt;BR /&gt;&lt;BR /&gt;please share as well the O/p of the  command&lt;BR /&gt;&lt;BR /&gt;crontab -e as run as root&lt;BR /&gt;&lt;BR /&gt;regards</description>
      <pubDate>Tue, 12 Jan 2010 08:57:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562585#M371850</guid>
      <dc:creator>sujit kumar singh</dc:creator>
      <dc:date>2010-01-12T08:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562586#M371851</link>
      <description>Actually there is no error being encountered.&lt;BR /&gt;&lt;BR /&gt;I placed several lines inside my scripts to echo everything that it does to a file. There are actually two parts of the script logging. 1st part it logs the date, time of execution. 2nd part it logs several select commands to the DB.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The log looks like this when executed manually:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;===&amp;gt; START Tue Jan 12 04:30:00 EAT 2010&lt;BR /&gt;&lt;BR /&gt;Date From:&lt;BR /&gt;Date To:&lt;BR /&gt;Processing DM ACR&lt;BR /&gt;Interactive mode off.&lt;BR /&gt;&lt;BR /&gt;(1 row affected)&lt;BR /&gt;Create table tempdb..XXX_ACR&lt;BR /&gt;(0 rows affected)&lt;BR /&gt;Extract ACR for Stream 0&lt;BR /&gt;(643 rows affected)&lt;BR /&gt;Consolidate data for Stream 0&lt;BR /&gt;&lt;BR /&gt;===&amp;gt; END Tue Jan 12 15:09:52 EAT 2010&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;However when executed via cron, it only outputs:&lt;BR /&gt;&lt;BR /&gt;===&amp;gt; START Tue Jan 12 15:14:00 EAT 2010&lt;BR /&gt;&lt;BR /&gt;Date From:&lt;BR /&gt;Date To:&lt;BR /&gt;Processing DM ACR&lt;BR /&gt;Interactive mode off.&lt;BR /&gt;===&amp;gt; END Tue Jan 12 15:14:01 EAT 2010&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I dont know why this is happening when the scripts is executed via cron.&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Jan 2010 09:08:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562586#M371851</guid>
      <dc:creator>sysad_boy</dc:creator>
      <dc:date>2010-01-12T09:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562587#M371852</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;what are your crontab entries for the same job , can you please tell.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;try redirecting the O/P as well as errors to some file and check.&lt;BR /&gt;&lt;BR /&gt;also you can check actual result that this should perform sa run as a cron job for the same.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;sujit</description>
      <pubDate>Tue, 12 Jan 2010 09:16:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562587#M371852</guid>
      <dc:creator>sujit kumar singh</dc:creator>
      <dc:date>2010-01-12T09:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562588#M371853</link>
      <description>&lt;!--!*#--&gt;Seems that your script does not find some file/utility. Maybe you should try to set in the script the PATH variable, like in:&lt;BR /&gt;&lt;BR /&gt;PATH=/usr/sbin:/usr/bin:/whatever....&lt;BR /&gt;&lt;BR /&gt;(You can copy this variable from the one that your system is using - see profile for root)&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Horia.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Jan 2010 09:17:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562588#M371853</guid>
      <dc:creator>Horia Chirculescu</dc:creator>
      <dc:date>2010-01-12T09:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562589#M371854</link>
      <description>PATH is already defined in the user's .profile do I also need to place it inside my script?</description>
      <pubDate>Tue, 12 Jan 2010 09:24:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562589#M371854</guid>
      <dc:creator>sysad_boy</dc:creator>
      <dc:date>2010-01-12T09:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562590#M371855</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;PATH is already defined in the user's .profile ..&amp;lt;&amp;lt;&lt;BR /&gt;&lt;BR /&gt;Please notice that no login is performed when a cron job is executed, hence the user's .profile is not read.&lt;BR /&gt;You should define your variables or the full command paths in your script.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Tue, 12 Jan 2010 09:41:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562590#M371855</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2010-01-12T09:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562591#M371856</link>
      <description>As John Korterman pointed, you must declare this in your script (in order to avoid strange behavoir of your script).&lt;BR /&gt;&lt;BR /&gt;Horia.</description>
      <pubDate>Tue, 12 Jan 2010 09:45:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562591#M371856</guid>
      <dc:creator>Horia Chirculescu</dc:creator>
      <dc:date>2010-01-12T09:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562592#M371857</link>
      <description>Ok, i just did your advice but to no avail. Same result.</description>
      <pubDate>Tue, 12 Jan 2010 11:05:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562592#M371857</guid>
      <dc:creator>sysad_boy</dc:creator>
      <dc:date>2010-01-12T11:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562593#M371858</link>
      <description>What exactly does your script? Can you post it here?&lt;BR /&gt;&lt;BR /&gt;Horia.</description>
      <pubDate>Tue, 12 Jan 2010 11:06:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562593#M371858</guid>
      <dc:creator>Horia Chirculescu</dc:creator>
      <dc:date>2010-01-12T11:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562594#M371859</link>
      <description>&amp;gt;but to no avail.&lt;BR /&gt;&lt;BR /&gt;Adding "set -x" to the start of your script will log commands as executed.  Then look need the end for the error.&lt;BR /&gt;&lt;BR /&gt;I assume you aren't trying to use any aliases you have defined in your .profile?</description>
      <pubDate>Tue, 12 Jan 2010 11:43:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562594#M371859</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-01-12T11:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562595#M371860</link>
      <description>&amp;gt;4. Placed an ampersand "&amp;amp;" at the end of the script in crontab (e.g.: * * * * * /dir/script.sh &amp;amp;)&lt;BR /&gt;&lt;BR /&gt;Why would you want to do that?  The crontab entry is already being processed asynchronously and you should let it wait until done.</description>
      <pubDate>Tue, 12 Jan 2010 11:44:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562595#M371860</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-01-12T11:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562596#M371861</link>
      <description>Hi again,&lt;BR /&gt;&lt;BR /&gt;check also the mail of the script-executing user: if you have not redirected output from cron execution to a file, it will appear there.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Tue, 12 Jan 2010 12:47:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562596#M371861</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2010-01-12T12:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562597#M371862</link>
      <description>Try to redirect also the standard error, maybe it not get its way  to the logfile. Something like:&lt;BR /&gt;&lt;BR /&gt;command 2&amp;gt;&amp;amp;1 1&amp;gt;/path/to/logfile&lt;BR /&gt;&lt;BR /&gt;may help. Edit your script.</description>
      <pubDate>Wed, 13 Jan 2010 14:22:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562597#M371862</guid>
      <dc:creator>Viktor Balogh</dc:creator>
      <dc:date>2010-01-13T14:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562598#M371863</link>
      <description>actually there is no error while the script is being executed either manually or via cron. Its just that the logging capabilities are not working when the script runs automatically with the use of cron.&lt;BR /&gt;&lt;BR /&gt;what actually the script does it is selecting data from a table, and then drops it. &lt;BR /&gt;&lt;BR /&gt;If the script is ran manually, an output of affected rows is logged. The output looks like this:&lt;BR /&gt;&lt;BR /&gt;(1 row affected)&lt;BR /&gt;Create table tempdb..XXX_ACR&lt;BR /&gt;(0 rows affected)&lt;BR /&gt;Extract ACR for Stream 0&lt;BR /&gt;(644 rows affected)&lt;BR /&gt;Consolidate data for Stream 0&lt;BR /&gt;(644 rows affected)&lt;BR /&gt;DROP TABLE  for tempdb..XXX_ACR_0&lt;BR /&gt;Extract ACR for Stream 1&lt;BR /&gt;(608 rows affected)&lt;BR /&gt;&lt;BR /&gt;Using cron, the above output is not logged when the script executes.&lt;BR /&gt;&lt;BR /&gt;I don't know why I can't successfully log everything to my logfile when the script runs using cron. What's with cron and manually executing the script?&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Jan 2010 02:49:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562598#M371863</guid>
      <dc:creator>sysad_boy</dc:creator>
      <dc:date>2010-01-14T02:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562599#M371864</link>
      <description>&lt;!--!*#--&gt;&amp;gt; [...] What's with cron and manually&lt;BR /&gt;&amp;gt; executing the script?&lt;BR /&gt;&lt;BR /&gt;Who can see "the script"?  You and the&lt;BR /&gt;psychics?  I'm neither.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Adding "set -x" [...]&lt;BR /&gt;&lt;BR /&gt;Did you try that?&lt;BR /&gt;&lt;BR /&gt;&amp;gt; command 2&amp;gt;&amp;amp;1 1&amp;gt;/path/to/logfile&lt;BR /&gt;&lt;BR /&gt;Did you try that?&lt;BR /&gt;&lt;BR /&gt;Did you try anything which might give us some&lt;BR /&gt;useful information?</description>
      <pubDate>Thu, 14 Jan 2010 04:20:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562599#M371864</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2010-01-14T04:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562600#M371865</link>
      <description>&amp;gt;What's with cron and manually executing the script?&lt;BR /&gt;&lt;BR /&gt;Have you removed that "&amp;amp;"?  cron may "hangup" the process tree when the initial shell exits because it isn't waiting for your script.&lt;BR /&gt;&lt;BR /&gt;How long does the script take to run?  Use time in both cases:&lt;BR /&gt;time /dir/script.sh&lt;BR /&gt;(This will send cron mail so remove when done.)</description>
      <pubDate>Thu, 14 Jan 2010 04:40:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562600#M371865</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-01-14T04:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562601#M371866</link>
      <description>&amp;gt;actually there is no error while the script is being executed either manually or via cron.&lt;BR /&gt;&lt;BR /&gt;No, it's not about errors. The standard error is a 'separate channel' to output messages to, and some applications like rsync output messages also to stderr even if they are succesfully finished. Please try that method I suggested and report back if it helped.&lt;BR /&gt;&lt;BR /&gt;# command 2&amp;gt;&amp;amp;1 1&amp;gt;/path/to/logfile&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Jan 2010 11:59:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562601#M371866</guid>
      <dc:creator>Viktor Balogh</dc:creator>
      <dc:date>2010-01-14T11:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562602#M371867</link>
      <description>&amp;gt;Viktor: command 2&amp;gt;&amp;amp;1 1&amp;gt;/path/to/logfile&lt;BR /&gt;&lt;BR /&gt;Did you really want to redirect FD in this order?  This will send stderr to the previous stdout, then the new stdout is going to logfile.&lt;BR /&gt;Typically if you want both to the same file:&lt;BR /&gt;... &amp;gt; /path/to/logfile 2&amp;gt;&amp;amp;1</description>
      <pubDate>Fri, 15 Jan 2010 11:40:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562602#M371867</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-01-15T11:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Script Execution Unable to Log When Executed Via Cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562603#M371868</link>
      <description>Dennis, you are right. Until now I never noticed that the order also counts. This way works:&lt;BR /&gt;&lt;BR /&gt;# command 1&amp;gt;/path/to/logfile 2&amp;gt;&amp;amp;1 &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 15 Jan 2010 13:16:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-execution-unable-to-log-when-executed-via-cron/m-p/4562603#M371868</guid>
      <dc:creator>Viktor Balogh</dc:creator>
      <dc:date>2010-01-15T13:16:53Z</dc:date>
    </item>
  </channel>
</rss>

