Created
January 20, 2016 17:29
-
-
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).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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