Skip to content

Instantly share code, notes, and snippets.

Created December 7, 2017 16:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
# This script is made to run inside a docker container, when we need to watch for changes in the container and build.
# Initially used for watching changes and doing a Hugo build, but this should be pretty general purpose.
# We simply calculate the md5sum of the entire directory every second, and trigger the build command if something has changed
while :
VALUE=`tar --exclude="dir/to/exclude" --exclude="anotherdir/to/exclude" -cf - . | md5sum`
if [ "$VALUE" != "$PREV_VALUE" ]; then
./command_to_run # or the script to run
sleep 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment