Created
September 13, 2014 04:36
-
-
Save renfredxh/b06c09158e2d07c4a220 to your computer and use it in GitHub Desktop.
Watch directory and evaluate command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
path="../grails-app" | |
command="grails compile" | |
chsum1="" | |
echo "Watching ${path} for changes" | |
while [[ true ]] | |
do | |
chsum2=`find ${path} -type f -exec md5sum {} \;` | |
if [[ $chsum1 != $chsum2 ]] ; then | |
date +"[%T] Running ${command}" | |
eval "grails compile" | |
chsum1=$chsum2 | |
fi | |
sleep 2 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment