Normalmente, giro para incron
para gerenciar as tarefas de inotificação:
sudo apt-get install incron
Crie um arquivo incron em /etc/incron.d:
echo '/tmp IN_ALL_EVENTS echo "$$ $@ $# $% $&"' > /etc/incron.d/watch-dir-tmp
Isso irá despejar TODOS os eventos em / tmp para / var / log / syslog:
date > /tmp/date
Apr 30 21:29:26 vault incrond[10144]: (system::watch-dir-tmp) CMD (echo "$ /tmp date IN_MODIFY 2")
Apr 30 21:29:26 vault incrond[10144]: (system::watch-dir-tmp) CMD (echo "$ /tmp date IN_OPEN 32")
Apr 30 21:29:26 vault incrond[10144]: (system::watch-dir-tmp) CMD (echo "$ /tmp date IN_MODIFY 2")
Apr 30 21:29:26 vault incrond[10144]: (system::watch-dir-tmp) CMD (echo "$ /tmp date IN_CLOSE_WRITE 8")
cat /tmp/date
Apr 30 21:29:33 vault incrond[10144]: (system::watch-dir-tmp) CMD (echo "$ /tmp date IN_OPEN 32")
Apr 30 21:29:33 vault incrond[10144]: (system::watch-dir-tmp) CMD (echo "$ /tmp date IN_ACCESS 1")
Apr 30 21:29:33 vault incrond[10144]: (system::watch-dir-tmp) CMD (echo "$ /tmp date IN_CLOSE_NOWRITE 16")
rm /tmp/date
Apr 30 21:29:40 vault incrond[10144]: (system::watch-dir-tmp) CMD (echo "$ /tmp date IN_DELETE 512")