【问题标题】:Run upstart task on file change?在文件更改上运行新贵任务?
【发布时间】:2016-11-29 01:29:44
【问题描述】:

这是我的尝试:

start on (filesystem and net-device-up IFACE!=lo and file EVENT=modify FILE="/tmp/bar.txt")

task

script
  chdir /tmp
  exec echo THIS_CHANGED >> CHANGEDDDDDDDD
end script

但它只运行一次。每当修改/tmp/bar.txt 时如何使其运行?

【问题讨论】:

    标签: upstart inotify inotifywait


    【解决方案1】:

    相当糟糕的解决方案,但这就是我能够开始工作的全部:

    start on (filesystem and net-device-up IFACE!=lo)
    
    script
      chdir /tmp
      while inotifywait -e modify "/tmp/bar.txt"; do
        echo THIS_CHANGED >> CHANGEDDDDDDDD
      done
    end script
    

    不希望添加我自己的inotify 观察者;而是使用系统级别一。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-02-23
      • 1970-01-01
      • 2019-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多