Skip to content

Instantly share code, notes, and snippets.

@aladagemre
Created January 20, 2016 17:29
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 aladagemre/1f0653f5ff58a03c7854 to your computer and use it in GitHub Desktop.
Save aladagemre/1f0653f5ff58a03c7854 to your computer and use it in GitHub Desktop.
This script looks for changes in Dropbox folder. Upon any change, waits for the status to be Up to date. When it's fully synced, starts a build process (/app/build.bin).
#!/bin/sh
uptodate () {
# returns 1 if up to date, 0 otherwise.
python /root/dropbox.py status | grep "Up to date" |wc -l
}
build_after_uptodate() {
while [ "$(uptodate)" != "1" ]; do
sleep 1
done
echo "Build now!"
/app/build.bin
}
while true #run indefinitely
do
if [ -d "/root/Dropbox" ]; then
inotifywait -r -e modify,attrib,close_write,move,create,delete ~/Dropbox && build_after_uptodate
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment