<?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: cron based find command problems in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995811#M125366</link>
    <description>have you tried the command list this:&lt;BR /&gt;&lt;BR /&gt;find . -name *.dbf -mtime +1 -print {} \;</description>
    <pubDate>Thu, 12 Jun 2003 13:13:44 GMT</pubDate>
    <dc:creator>John Meissner</dc:creator>
    <dc:date>2003-06-12T13:13:44Z</dc:date>
    <item>
      <title>cron based find command problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995802#M125357</link>
      <description>OK,  Here's one to challenge the old braincells.&lt;BR /&gt;&lt;BR /&gt;I have a script running from cron, on an L3000 (dual CPU) under HP-UX 11.11, which executes the following code&lt;BR /&gt;&lt;BR /&gt;cd $ARCHIVEDIR&lt;BR /&gt;for file in `find . -name "*.dbf" -mtime +1 -print`&lt;BR /&gt;do&lt;BR /&gt; echo "Processing file $file"&lt;BR /&gt; /usr/contrib/bin/gzip $file&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;For some reason, the find command does not bring back any files.&lt;BR /&gt;&lt;BR /&gt;Looking in a log, with debugging enabled, I get&lt;BR /&gt;&lt;BR /&gt;+ cd /oradata1/archive/SCP01&lt;BR /&gt;+ find . -name *.dbf -mtime +1 -print&lt;BR /&gt;&lt;BR /&gt;so it's resolving the value of $ARCHIVEDIR correctly.&lt;BR /&gt;&lt;BR /&gt;Running the command manually, I get files listed.&lt;BR /&gt;&lt;BR /&gt;./1_1431.dbf&lt;BR /&gt;./1_1432.dbf&lt;BR /&gt;./1_1433.dbf&lt;BR /&gt;./1_1434.dbf&lt;BR /&gt;./1_1435.dbf&lt;BR /&gt;./1_1436.dbf&lt;BR /&gt;./1_1437.dbf&lt;BR /&gt;./1_1438.dbf&lt;BR /&gt;./1_1439.dbf&lt;BR /&gt;./1_1440.dbf&lt;BR /&gt;./1_1441.dbf&lt;BR /&gt;./1_1442.dbf&lt;BR /&gt;./1_1443.dbf&lt;BR /&gt;&lt;BR /&gt;Initially, I was using find . -name "*.dbf" -mtime +1 -exec /usr/contrib/bin/gzip {} \;&lt;BR /&gt;&lt;BR /&gt;but that was also not working&lt;BR /&gt;( I switched to the loop to try to get to the bottom of the issue)&lt;BR /&gt;&lt;BR /&gt;Trying the find without the -mtime option (not gzipping this time as I don't want to risk damaging my current files) I get the files displayed - aha you may think, something wrong with the mtime option, however, when using -mtime +1 without giving a filename, the files that have already been gzipped in that directory are displayed.&lt;BR /&gt;&lt;BR /&gt;The files are not in use by another process (at least fuser reports nothing) and can be manually zipped with no errors.&lt;BR /&gt;&lt;BR /&gt;So what can it be that causes find to work correctly with either a name, or an mtime option with no problems, but to only partially work when both are specified?</description>
      <pubDate>Thu, 12 Jun 2003 12:30:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995802#M125357</guid>
      <dc:creator>Chris Wilshaw</dc:creator>
      <dc:date>2003-06-12T12:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: cron based find command problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995803#M125358</link>
      <description>I've tried using both /usr/bin/sh and /usr/bin/ksh to no avail, and I've deleted and re-typed the line several times in vi (using :set list too) to make sure that I've not inadvertantly added any control characters</description>
      <pubDate>Thu, 12 Jun 2003 12:33:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995803#M125358</guid>
      <dc:creator>Chris Wilshaw</dc:creator>
      <dc:date>2003-06-12T12:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: cron based find command problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995804#M125359</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have done the following :&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;cd /tmp&lt;BR /&gt;for i in `find . -name \*.dbf  -mtime +1 -print`&lt;BR /&gt;do&lt;BR /&gt;echo "Hello $i"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;created two files 1.dbf and 2.dbf. Nothing got printed until I removed the mtime option. So everything works fine. &lt;BR /&gt;I must strongly advise to not use any variables in a cron driven script. These vars should be known my the executor from cron. Please use a realdir-name instead of a var. It should definitly work than.&lt;BR /&gt;&lt;BR /&gt;Regs David&lt;BR /&gt;&lt;BR /&gt;B.T.W. know that you are displaying files older than 1 day. I asume the files are older than one day ? :)</description>
      <pubDate>Thu, 12 Jun 2003 12:47:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995804#M125359</guid>
      <dc:creator>David_246</dc:creator>
      <dc:date>2003-06-12T12:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: cron based find command problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995805#M125360</link>
      <description>You probably do not want the search string in double quotes.&lt;BR /&gt;&lt;BR /&gt;This will evaluate the search template "*.dbf". What I do in this case is twofold,...&lt;BR /&gt;&lt;BR /&gt;No quotes around the search criteria&lt;BR /&gt;Escape Char (\) before every occurence of a search character like $*[]() and .&lt;BR /&gt;&lt;BR /&gt;Share and Enjoy! Ian</description>
      <pubDate>Thu, 12 Jun 2003 12:52:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995805#M125360</guid>
      <dc:creator>Ian Dennison_1</dc:creator>
      <dc:date>2003-06-12T12:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: cron based find command problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995806#M125361</link>
      <description>Chris,&lt;BR /&gt;&lt;BR /&gt;I suspect it's the old cron's environment answer.  Your $ARCHIVEDIR is not set.  Either source an environment script when setting up cron jobs, or use full path names and explicitly set any variables.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Thu, 12 Jun 2003 12:53:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995806#M125361</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-06-12T12:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: cron based find command problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995807#M125362</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I tried it on my system with -name AND -mtime +1 and I can't make it fail ... I even tried from cron and it still works. I also looked for a patch but nothing concerns your problem.&lt;BR /&gt;&lt;BR /&gt;Do you really launch exacly this script from your crontab ?&lt;BR /&gt;&lt;BR /&gt;Regards.</description>
      <pubDate>Thu, 12 Jun 2003 12:54:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995807#M125362</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2003-06-12T12:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: cron based find command problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995808#M125363</link>
      <description>Chris,&lt;BR /&gt;&lt;BR /&gt;Please disregard my ill-advised and uninformed prior answer.  I'm still working on my reading skills.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Thu, 12 Jun 2003 12:58:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995808#M125363</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-06-12T12:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: cron based find command problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995809#M125364</link>
      <description>Not sure why this is not working.  A possible work-around for the time-being is to filter the list produced by the find command:&lt;BR /&gt;&lt;BR /&gt;for file in `find . -mtime +1 -print | grep \.dbf$` &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;For debugging, try echoing $ARCHIVEDIR to a file, along with the output of the find command by itself.</description>
      <pubDate>Thu, 12 Jun 2003 13:08:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995809#M125364</guid>
      <dc:creator>Bill Douglass</dc:creator>
      <dc:date>2003-06-12T13:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: cron based find command problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995810#M125365</link>
      <description>Hi,&lt;BR /&gt;your code works on my system as well!&lt;BR /&gt;But I do not personally like the use of  the word "file", as I have the idea it could conflict with the built-in function of the same name. However, it apparently does not disturb my shell - could it be disturbing yours?&lt;BR /&gt;Far out, but...&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;</description>
      <pubDate>Thu, 12 Jun 2003 13:10:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995810#M125365</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-06-12T13:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: cron based find command problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995811#M125366</link>
      <description>have you tried the command list this:&lt;BR /&gt;&lt;BR /&gt;find . -name *.dbf -mtime +1 -print {} \;</description>
      <pubDate>Thu, 12 Jun 2003 13:13:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995811#M125366</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-06-12T13:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: cron based find command problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995812#M125367</link>
      <description>sorry... nope.. that didn't work.</description>
      <pubDate>Thu, 12 Jun 2003 13:14:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995812#M125367</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-06-12T13:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: cron based find command problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995813#M125368</link>
      <description>escape the star sign.&lt;BR /&gt;&lt;BR /&gt;find . -name \*.bdf -exec gzip {}\;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;peace&lt;BR /&gt;Donny</description>
      <pubDate>Thu, 12 Jun 2003 13:22:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995813#M125368</guid>
      <dc:creator>Donny Jekels</dc:creator>
      <dc:date>2003-06-12T13:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: cron based find command problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995814#M125369</link>
      <description>Hi,&lt;BR /&gt;maybe simple, but with which user are you executing the cron command ? the same as in interative mode ?&lt;BR /&gt;&lt;BR /&gt;Is there any customization in the /var/adm/cron/.proto that may prevent the proper work ?&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt; Massimo&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 12 Jun 2003 13:48:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995814#M125369</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2003-06-12T13:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: cron based find command problems</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995815#M125370</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;three points:&lt;BR /&gt;&lt;BR /&gt;1. is your script using find, or /usr/bin/find?&lt;BR /&gt;2. Did you think of putting the mandatory #/usr/bin/ksh at the beginning of the script?&lt;BR /&gt;3. did you actually put the double quotes around "*.dbf" ?&lt;BR /&gt;&lt;BR /&gt;I have run some tests on my system, and the script ran fine as long as I had thought of the three points above...&lt;BR /&gt;&lt;BR /&gt;On the other hand, trying to launch the command on the crontab without putting it in a script failed, because cron uses the posix shell and not the kron shell...&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;FiX&lt;BR /&gt;</description>
      <pubDate>Thu, 12 Jun 2003 14:13:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-based-find-command-problems/m-p/2995815#M125370</guid>
      <dc:creator>F. X. de Montgolfier</dc:creator>
      <dc:date>2003-06-12T14:13:34Z</dc:date>
    </item>
  </channel>
</rss>

