0

这是我的尝试:

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

4

1 回答 1

0

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

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观察者;而是使用系统级别一。

于 2016-11-29T09:18:58.213 回答