Hello everyone! 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... #!/bin/bash ############### detectdir.sh by Jagbir Singh ################# # # script to detect changes in directory. # ############################################################### # directory to watch DIR="/var/www/vhosts" # store current statistics of dir OLD=`stat -t $DIR` while true do # take a new snapshot of stats NEW=`stat -t $DIR` # compare it with old if [ "$NEW" != "$OLD" ]; then echo "changed!" ## you may want to comment this # take current listing of dir in a file. domains may be added or removed. ls $DIR --file-type | grep "\/" | sed 's/\///' > /tmp/dir.list # open file and you can now process entries in it exec 10 let count=0 while read LINE <&10; do # currently printed on screen, can supply this as arg to rSync, discussed later echo $LINE/httpdocs/ echo ((count++)) done # take snapshot again and store it in both old and new vars NEW=`stat -t $DIR` OLD=$NEW exec 10>&- fi # i'm using 3 secs calm time, you should update this as per your environment sleep 3 done -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20100126/c0a69d1c/attachment-0004.html>