API workers using Gearman::Driver
[cloudstore.git] / gearman / list_files
index 4be8768..03fae20 100755 (executable)
@@ -1,11 +1,12 @@
 #!/bin/sh
 
 while read path ; do
-       echo `date +%Y-%m-%d.%H:%M:%S`" list_files [$path]" >&2
+       echo `date +%Y-%m-%d.%H:%M:%S`" list_files [$path] START" >&2
        eval path=$path # expand ~
        if [ -e $path/.meta/files ] ; then
                cat $path/.meta/files
        else
-               find -L $path -printf "%y %s %p\n" | tee $path/.meta/files
+               cd $path && find -L . -printf "%y %s %p\n" | tee $path/.meta/files.new && mv $path/.meta/files.new $path/.meta/files
        fi
+       echo `date +%Y-%m-%d.%H:%M:%S`" list_files [$path] END" >&2
 done