Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcnatt committed Apr 11, 2017
1 parent 7af5df4 commit 3d68391
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions boxsync
Original file line number Original file line Diff line number Diff line change
@@ -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.