Skip to content
Permalink
Browse files

Initial commit

  • Loading branch information...
jmcnatt committed Apr 11, 2017
1 parent 7af5df4 commit 3d683912c08e91a3b88121e98ecddfdb180b5db0
Showing with 28 additions and 0 deletions.
  1. +28 −0 boxsync
28 boxsync
@@ -0,0 +1,28 @@
#!/bin/bash

logpath=/var/log/boxsync
boxdavlocation=/mnt/box-dav
boxdest=/mnt/box

writelog() {
while IFS= read -r line; do
printf "%s boxsync: %s\n" "$(date +'%F %H:%M:%S')" "$line" >> $logpath
done
}

# Mount Box location
/bin/mount -t davfs https://dav.box.com/dav $boxdavlocation
echo "Mount box-dav at $boxdavlocation" | writelog

# Begin rsync
# -u update
# -r recursive
# --progress show progress
# --delete delete files not in source
echo "Starting sync" | writelog
/bin/rsync -urh --progress --delete --exclude 'Podcasts' --exclude 'Playlists' $boxdavlocation/* $boxdest | writelog
/bin/rsync -rh --progress --delete --temp-dir=/tmp $boxdest/Playlists/ $boxdavlocation/Playlists | writelog

# Unmount Box location
echo "Unmount box-dav at $boxdavlocation" | writelog
/bin/umount $boxdavlocation

0 comments on commit 3d68391

Please sign in to comment.
You can’t perform that action at this time.