Tuesday, August 26, 2014

Watch a file for changes on linux, then do something about it

#!/bin/sh

while true    
do
   ATIME=`stat -c %Z /path/to/the/file.txt`

   if [ "$ATIME" != "$LTIME" ]
   then    
       echo "RUN COMMNAD"
       LTIME=$ATIME
   fi
   sleep 5
done

No comments:

Post a Comment