How to efficiently monitor a directory for changes on linux?

旧时模样 提交于 2019-11-30 14:04:06

I suggest you use php-independent daemon to modify change date of your main css file when one of dependent php files are modified. You can use dnotify for it, something like:

dnotify -a -r -b -s /path/to/imported/css/files/ -e touch /path/to/main/css/file;

It will execute 'touch' on main css file each time one of the files in other folder are modified (-a -r -b -s = any access/recursive directory lookup/run in background/no output). Or you can do any other action and test for it from PHP.

If you use the command

ls -ltr `find . -type f `

It will give you a long listing of all files with the newest at the bottom.

Cédric Julien

Try to have a look to inotify packages that will allows you to be notified eah time a modification occurs in a directory.

I've never used it, but apparently there is inotify support for PHP.

(inotify would be the most efficient way to get notifications under Linux)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!