<?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: crontab commands fail in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-commands-fail/m-p/4359808#M345987</link>
    <description>Hi George,&lt;BR /&gt;&lt;BR /&gt;Thanks for the quick reply. Can you give me an example of how I can add the '+' at the end?&lt;BR /&gt;&lt;BR /&gt;Is it:&lt;BR /&gt;&lt;BR /&gt;NN NN * * * find &lt;DIR&gt; -name '*.trc' -exec chmod o+r {} + ??&lt;/DIR&gt;</description>
    <pubDate>Tue, 17 Feb 2009 03:30:07 GMT</pubDate>
    <dc:creator>Kanwar</dc:creator>
    <dc:date>2009-02-17T03:30:07Z</dc:date>
    <item>
      <title>crontab commands fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-commands-fail/m-p/4359806#M345985</link>
      <description>Hi,&lt;BR /&gt;I am a DBA with HP in Sydney. We have a peculiar issue with crontab entries that we are unable to resolve.&lt;BR /&gt;&lt;BR /&gt;A typical crontab entry looks like&lt;BR /&gt;NN NN * * * find &lt;DIR&gt; -name '*trc' -exec chmod o+r {} \; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;Now, if there are files in &lt;DIR&gt;, its ok. But if there are no files in &lt;DIR&gt;, the above command throws a ticket with an alert that the command failed.&lt;BR /&gt;I have tried modifying the command in various ways--one such attempt is listed below--but that fails as well.&lt;BR /&gt;&lt;BR /&gt;NN NN * * * [ $(ls -1A &lt;DIR&gt; | wc -l) != 0 ] &amp;amp;&amp;amp; find .....&lt;BR /&gt;&lt;BR /&gt;So, I try to count if there are files in &lt;DIR&gt; before I run the find and yet I get the error that "ls -1A etc" has failed.&lt;BR /&gt;&lt;BR /&gt;Is there a way to insulate commands in cron so that if there are no files to operate on, the command should just go away? Basically, if there are no files in &lt;DIR&gt;, it is not an error --from Oracle point-of-view.&lt;BR /&gt;&lt;BR /&gt;Please advise.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Kanwar&lt;/DIR&gt;&lt;/DIR&gt;&lt;/DIR&gt;&lt;/DIR&gt;&lt;/DIR&gt;&lt;/DIR&gt;</description>
      <pubDate>Tue, 17 Feb 2009 03:09:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-commands-fail/m-p/4359806#M345985</guid>
      <dc:creator>Kanwar</dc:creator>
      <dc:date>2009-02-17T03:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: crontab commands fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-commands-fail/m-p/4359807#M345986</link>
      <description>Hi Kanwar,&lt;BR /&gt;&lt;BR /&gt;What happens if you use a + at the end of the find command. The escaped \; is not going to work from crontabs. &lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;George</description>
      <pubDate>Tue, 17 Feb 2009 03:26:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-commands-fail/m-p/4359807#M345986</guid>
      <dc:creator>George Spencer_4</dc:creator>
      <dc:date>2009-02-17T03:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: crontab commands fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-commands-fail/m-p/4359808#M345987</link>
      <description>Hi George,&lt;BR /&gt;&lt;BR /&gt;Thanks for the quick reply. Can you give me an example of how I can add the '+' at the end?&lt;BR /&gt;&lt;BR /&gt;Is it:&lt;BR /&gt;&lt;BR /&gt;NN NN * * * find &lt;DIR&gt; -name '*.trc' -exec chmod o+r {} + ??&lt;/DIR&gt;</description>
      <pubDate>Tue, 17 Feb 2009 03:30:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-commands-fail/m-p/4359808#M345987</guid>
      <dc:creator>Kanwar</dc:creator>
      <dc:date>2009-02-17T03:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: crontab commands fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-commands-fail/m-p/4359809#M345988</link>
      <description>To avoid the \; at the end of find command, I have now modified it to find ... | xargs.&lt;BR /&gt;&lt;BR /&gt;Is this a better approach?</description>
      <pubDate>Tue, 17 Feb 2009 04:21:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-commands-fail/m-p/4359809#M345988</guid>
      <dc:creator>Kanwar</dc:creator>
      <dc:date>2009-02-17T04:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: crontab commands fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-commands-fail/m-p/4359810#M345989</link>
      <description>Hi Kanwar,&lt;BR /&gt;&lt;BR /&gt;If possible write a shell program and execute from crontab.&lt;BR /&gt;&lt;BR /&gt;Suraj</description>
      <pubDate>Tue, 17 Feb 2009 05:28:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-commands-fail/m-p/4359810#M345989</guid>
      <dc:creator>Suraj K Sankari</dc:creator>
      <dc:date>2009-02-17T05:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: crontab commands fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-commands-fail/m-p/4359811#M345990</link>
      <description>Thanks Suraj, I will try that.&lt;BR /&gt;&lt;BR /&gt;Thanks all.</description>
      <pubDate>Tue, 17 Feb 2009 05:54:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-commands-fail/m-p/4359811#M345990</guid>
      <dc:creator>Kanwar</dc:creator>
      <dc:date>2009-02-17T05:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: crontab commands fail</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-commands-fail/m-p/4359812#M345991</link>
      <description>It appears find(1) is broken because it doesn't document its exit status.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Is there a way to insulate commands in cron so that if there are no files to operate on, the command should just go away?&lt;BR /&gt;&lt;BR /&gt;You can just ignore all errors from the find:&lt;BR /&gt;NN NN * * * find &lt;DIR&gt; -name '*trc' -exec chmod o+r {} + &amp;gt; /dev/null 2&amp;gt;&amp;amp;1; true&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I have now modified it to find ... | xargs.&lt;BR /&gt;&amp;gt;Is this a better approach?&lt;BR /&gt;&lt;BR /&gt;No, using a "+" is much better.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;George: What happens if you use a + at the end of the find command. The escaped \; is not going to work from crontabs.&lt;BR /&gt;&lt;BR /&gt;Using "+" will make it faster.  But the "\;" should also work.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Suraj: write a shell program and execute from crontab.&lt;BR /&gt;&lt;BR /&gt;Yes, a shell script will allow you to set the exit status and check for no matches.&lt;/DIR&gt;</description>
      <pubDate>Tue, 17 Feb 2009 08:11:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-commands-fail/m-p/4359812#M345991</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-02-17T08:11:01Z</dc:date>
    </item>
  </channel>
</rss>

