Skip to content

Instantly share code, notes, and snippets.

@danielnegri
Created October 12, 2013 04:10
Show Gist options
  • Select an option

  • Save danielnegri/6945726 to your computer and use it in GitHub Desktop.

Select an option

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.
#!/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