Skip to content

Instantly share code, notes, and snippets.

@aktowns
Created June 28, 2015 12:43
Show Gist options
  • Save aktowns/cc2617084df714537d82 to your computer and use it in GitHub Desktop.
Save aktowns/cc2617084df714537d82 to your computer and use it in GitHub Desktop.
#!/bin/sh
while true; do
inotifywait -r -e close_write,moved_to,create "./src"
if [ -f ./server.pid ]; then kill $(cat server.pid); fi
crystal build $@
target=$(basename $@ | sed s/\.cr//)
echo "Executing $target"
./$target &
echo $! > server.pid
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment