Last active
September 4, 2017 23:01
-
-
Save aluxian/fe09c18b749d9eddae8d3e696a713085 to your computer and use it in GitHub Desktop.
Whitelist for Dropbox CLI selective sync + backup script + DockerCloud stackfile
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 | |
echo "Backing up data folders" | |
for i in *; do | |
echo "Archiving $i to .dropbox/data/Tutum/$i.tar.gz ..." | |
tar -cf - "$i" | gzip -9 - > ".dropbox/data/Tutum/$i.tar.gz" | |
done | |
echo "Done" |
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
cron: | |
environment: | |
- 'CRON_ENTRY=0 0 * * * cd /opt/tutum && ./.backup.sh' | |
image: 'lodatol/cron:latest' | |
restart: on-failure | |
volumes: | |
- '/mnt/data:/opt/tutum' | |
dropbox: | |
entrypoint: | | |
bash -c 'bash -s <<EOF | |
trap "break;exit" SIGHUP SIGINT SIGTERM | |
/root/dbox_whitelist.sh & | |
/root/run | |
EOF' | |
image: 'janeczku/dropbox:latest' | |
restart: on-failure | |
volumes: | |
- '/mnt/data/.dropbox/config:/dbox/.dropbox' | |
- '/mnt/data/.dropbox/data:/dbox/Dropbox' | |
- '/mnt/data/.dropbox/whitelist.sh:/root/dbox_whitelist.sh:ro' |
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/bash | |
echo "whitelist script init" | |
while :; do | |
sleep 10 # check every 10 seconds | |
EXCLUSIONS="" # this will contain the files/folders to be excluded | |
WHITELIST="Folder1;Folder2/Folder3;File1" # files and folders you wish to whitelist | |
for f in *; do | |
OLDIFS="$IFS" | |
export IFS=";" | |
for w in $WHITELIST; do | |
if [ "$f" != "$w" ]; then | |
dropbox exclude add "$e" | |
fi | |
done | |
export IFS="$OLDIFS" | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment