views:

44

answers:

1

I have a cronned "cp *.html" command that runs every minute on an OSX box. The source files are regenerated from a database and written to the source directory just fine. The cp command usually picks them up and refreshes the copies in /Library/WebServer/Documents (this is for a quick-and-dirty internal website that monitors one of our processes - we don't want to spend any extra cycles maintaining an appserver or anything similar, so we're just using OSX's built-in copy of Apache with default settings.)

We've noticed that when we add a new foo.html page to the source directory, the cronned cp command does not begin copying it over until we manually copy it once, even though it matches the *.html pattern. This seems crazy. Permissions and ownership all are set the same way (rw-r--r-- for everything in both directories).

Any ideas? If I can't figure out what is going wrong, I'll probably rewrite it to use rsync, but that seems like a cop-out.

+1  A: 

I'm not sure, but it looks like cron is expanding '*' only once (maybe at the first invocation?). Try using this as a command:

sh -c 'cp $OUR_DATA/reports/*.html /Library/WebServer/Documents'

This way your wildcards will be expanded every time from scratch.

liori