delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/11/14/06:12:11

X-Spam-Check-By: sourceware.org
Message-ID: <4559A462.5F4F0171@dessent.net>
Date: Tue, 14 Nov 2006 03:11:30 -0800
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Cron and find
References: <454146830002AB83 AT mail-6-uk DOT mail DOT tiscali DOT sys>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

will DOT wright AT tiscali DOT co DOT uk wrote:

> 4 10 * * 1-5 find /cygdrive/d/Apps_v8p4//Bridge/DataFeed/deploy//quotefeed/logs
> -type f -name stdout.log\.* -mtime +2 > /cygdrive/d/Apps_v8p4/Bridge/DataFeed/deploy/bin/testfind.log

The need for quoting the argument to -name is to keep the shell from
expanding globs (* and ?), so that they can be evalulated instead by
find.  This can be done either with quotes or backslashes, so I would
expect to see

-name stdout.log.\*

or

-name stdout.log\*

where the former would match only stdout.log.03Nov2006 and the latter
would match both that and stdout.log.  However, what you have:

-name stdout.log\.*

does not make any sense as the "." is not a glob character and does not
need to be quoted, leaving the "*" unprotected and vulnerable to shell
expansion if there happened to be a matching filename in the current
directory (although that typically results in syntax errors from find.) 
This could explain why it happens to work from the command line but not
in cron, but it's kind of a long shot.  I don't see any other common
cron problems (D is not a network drive and your mounts are
system-mode.)  In any case I would fix the quoting, regardless of other
issues.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019