Skip to content

Instantly share code, notes, and snippets.

@bguiz
Created November 3, 2013 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bguiz/7288196 to your computer and use it in GitHub Desktop.
Save bguiz/7288196 to your computer and use it in GitHub Desktop.
useful for automating deployments
wget https://bitbucket.org/denilsonsa/small_scripts/raw/9159fee62dc7cca7f81f47cef41bd9ae1324553e/sleep_until_modified.py
chmod u+x ./sleep_until_modified.py
touch testfile.old
touch testfile
#note limitation of this script: needs file to exist beforehand
while ./sleep_until_modified.py testfile || sleep 1; do echo "diff detected" $( date -u --rfc-3339=seconds ) ; diff testfile.old testfile ; cp testfile testfile.old ; done
# in a new terminal - for testing purposes
sleep 2 && echo "a new line" >> testfile
sleep 1 && touch testfile
sleep 1 && echo "another line" >> testfile
sleep 2 && touch testfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment