[CentOS] Detect file change

John Doe jdmls at yahoo.com
Tue Jan 26 12:05:06 UTC 2010


From: Alan Hoffmeister <alangtk at gmail.com>
>How can I detect if a folder have changed (sync logic) than run a
>script if it's true?
>>I found this script over the net, but I think it's such complicated for
>that simple thing...

You could do something like (untested):

  CHECKFILE="/path/to/checkfile"
  if [! -f $CHECKFILE]; then touch $CHECKFILE; fi
  find -cnewer $CHECKFILE | myscript.sh
  touch $CHECKFILE

JD


      


More information about the CentOS mailing list