Michael Stone wrote:
> >I have a crontab installed on a server that does that:
> >find $ORIGDIR -type f -exec stat -c "%n" {} \; |sort > $CURRENT_FILE
> 
> Why? That'll give the same output as find $ORIGDIR -type f |sort > 
> $CURRENT_FILE
> but with an extra process spawned for each filesystem entry.

Agreed.  Using the extra process for stat is very inefficient when
compared to the alternative.

> >How can it be that from one day to the other the file is sorted 
> >differently ??
> 
> If I had to guess I'd say that someone restarted cron and their
> environment is different than the system default one. (I.e., either
> their LANG is unset or set to C, or their LC_COLLATE is set to C.)

Agreed.

Eric, please verify that your locale is set to a reasonable sort
value.  You can run a test and have cron mail the result to you.  This
will do so every minute.  After you get one you can remove it.  I am
sure you won't forget to remove it because it will remind you every
minute.  :-)

  */1 * * * *       locale | mailx -s locale $(whoami)

Or if this is in a script in cron.daily or wherever you can always put
that into the script.

It is probably best if you set the desired locale variables in your
script.  Then it will always have the same locale setting.  You can do
this in your script.  Or if this is a personal crontab you can set it
there.

Bob


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to