Created
October 12, 2013 04:10
-
-
Save danielnegri/6945726 to your computer and use it in GitHub Desktop.
This a md5 implementation of the nickjj/gowatcher script. The reason that I've decided to use md5sum instead inotify-tools it's because I'm using sync folder through Vagrant.
This file contains hidden or 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 | |
| # go $1 $2 & | |
| sum="0" | |
| while true; | |
| do | |
| tmp=`find . -type f -name "*.go" -exec md5sum {} + | awk '{print $1}' | sort | md5sum | awk '{print $1}'` | |
| if [ "$sum" != "$tmp" ] | |
| then | |
| echo "Sum: $sum (changed)" | |
| pkill -9 -f a.out > /dev/null 2>&1 | |
| go install | |
| go $1 $2 & | |
| sum=$tmp | |
| fi | |
| sleep 1 | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment