aboutsummaryrefslogtreecommitdiff
path: root/files/sync-media
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-04-17 22:45:27 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-04-17 22:45:27 -0300
commitea668fd692a932f5017f370baa7cefc54db68087 (patch)
treeb7cf0ae05e6a2c2a0e334ec39b0ae1684efce174 /files/sync-media
parent20f71f19e928d3220ef0d9183e496b2018a10039 (diff)
downloadpuppet-backup-ea668fd692a932f5017f370baa7cefc54db68087.tar.gz
puppet-backup-ea668fd692a932f5017f370baa7cefc54db68087.tar.bz2
Try to copy files to a remote at sync-media
Diffstat (limited to 'files/sync-media')
-rw-r--r--files/sync-media18
1 files changed, 18 insertions, 0 deletions
diff --git a/files/sync-media b/files/sync-media
index 4e98e12..ea1c430 100644
--- a/files/sync-media
+++ b/files/sync-media
@@ -166,4 +166,22 @@ if [ ! -z "$DRIVE" ] && [ -d "$VOLUME/$MEDIA" ]; then
rsync -av --delete $CACHE/$folder/ $VOLUME/$MEDIA/$folder/
fi
done
+else
+ # Try to copy to a remote
+ for folder in `ls $CACHE`; do
+ if [ -d "$CACHE/$folder/.git/annex" ]; then
+ (
+ if git remote | grep -q "^$DISK$"; then
+ cd $CACHE/$folder
+ git annex copy . --to $DISK
+ else
+ echo "No such remote $DISK"
+ fi
+ )
+ else
+ REMOTE="$DISK.$DOMAIN"
+ echo "Syncing $VOLUME/$MEDIA/$folder..."
+ rsync -av --delete $CACHE/$folder/ $REMOTE:$CACHE/$folder/
+ fi
+ done
fi