Many other questions is about this around StackOverflow. I haven't found any where the result doesn't use any 3rd party package.

围绕StackOverflow还有很多其他问题。我没有找到任何结果不使用任何第三方包的地方。

The problem is that I'm using Hetzner and they want allow me to install any packages.

问题是我正在使用Hetzner,他们希望允许我安装任何软件包。

I can use PHP, Python, Java (think pretty much the standard collection)

我可以使用PHP,Python,Java(几乎认为是标准集合)

How to monitor a directory (recursive) for new files and get the references into another file.

如何监视新文件的目录(递归)并将引用引入另一个文件。

I have tried something like this:

我尝试过这样的事情:

while true; do
    last=`cat log.txt`
    find "$UPLOAD_FOLDER"'/.' -type f > 'log.txt'
    now=`cat log.txt`

    diff -n <(echo "$last") <(echo "$now") >> 'queue.txt'

    sleep 60;
done;

But it's unreliable and it pollutes queue.txt with d3a,b5a, etc..

但它不可靠,它用d3a,b5a等污染queue.txt。

2 个解决方案

#1


1

Probably the easiest is to use a marker file:

可能最简单的方法是使用标记文件:

touch markerFile
while true
do
    find "$UPLOAD_FOLDER"'/.' -type f -newer markerFile >> 'queue.txt'
    touch markerFile
    sleep 60
done

Might be a slight race condition between the find and the touch?

在发现和触摸之间可能会出现轻微的竞争条件?

A more complicated double buffering solution as suggested in the comments:

一个更复杂的双缓冲解决方案,如评论中所示:

touch markerFileA
touch markerFileB
while true
do
    touch markerFileB
    find "$UPLOAD_FOLDER"'/.' -type f -newer markerFileA ! -newer markerFileB >> 'queue.txt'
    sleep 60
    touch markerFileA
    find "$UPLOAD_FOLDER"'/.' -type f -newer markerFileB ! -newer markerFileA >> 'queue.txt'
    sleep 60
done

更多相关文章

  1. Media-S 简介(一个开源的DRM解决方案)
  2. AppScan安全问题解决方案
  3. PLSQL乱码解决方案
  4. sqlserver 存储过程 递归查询分组+hierarchyid重建会员关系
  5. 数据库不支持中文解决方案(mysql)
  6. Mysql替代解决方案Cassandra
  7. SQL Server 2005递归查询在数据中有循环,这是可能的吗?
  8. [置顶] Android屏幕适配解决方案
  9. 物流货运移动APP解决方案

随机推荐

  1. Android电子商务企业项目案例技术搜集
  2. [置顶] Android入门系列一(Android学习方
  3. Android Studio试用总结
  4. Android AsyncTask解析
  5. Couldn't find meta-data for provider w
  6. .net程序员转战android第二篇---牛刀小试
  7. 理解Android的菜单
  8. Android之MPAndroidChart库使用说明(柱状
  9. Android NFS文件系统挂载遇到的问题解决
  10. Android里面常用的Drawable的使用