dotfiles

Obligatory dotfiles repo
git clone git://git.danielmoch.com/dotfiles.git
Log | Files | Refs

commit 9243394e4dc440effab337738006076cac1b0678
parent 0d755ccf26190dcd78f64f9eb2630367be689095
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Sun, 22 Jul 2018 16:05:12 -0400

Unison is really slow. Go back to Rsync except for notes.

Diffstat:
M.local/lib/cron.avail/cloudsync.sh | 31++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/.local/lib/cron.avail/cloudsync.sh b/.local/lib/cron.avail/cloudsync.sh @@ -52,9 +52,10 @@ then echo "NextCloud WebDAV successfully mounted. Setting permissions." chmod 700 /mnt/nextcloud - echo "Syncing Photos between WebDAV and $LOCAL_PHOTOS" + # Rsync from WebDAV to ~/Photos + echo "Syncing Photos from WebDAV to $LOCAL_PHOTOS" [ ! -d $LOCAL_PHOTOS/$year/$month ] && mkdir -p $LOCAL_PHOTOS/$year/$month - unison -batch /mnt/nextcloud/Photos/$year/$month $LOCAL_PHOTOS/$year/$month + rsync -aq /mnt/nextcloud/Photos/$year/$month/* $LOCAL_PHOTOS/$year/$month if [ -z "$firstrun" -a $lastrun_month -ne $month ] then # TODO: What if we're more than a month behind? @@ -62,12 +63,32 @@ then then mkdir -p $LOCAL_PHOTOS/$lastrun_year/$lastrun_month fi - unison -batch /mnt/nextcloud/Photos/$lastrun_year/$lastrun_month $LOCAL_PHOTOS/$lastrun_year/$lastrun_month + rsync -aq /mnt/nextcloud/Photos/$lastrun_year/$lastrun_month/* $LOCAL_PHOTOS/$lastrun_year/$lastrun_month fi - echo "Syncing mobile documents between WebDAV and $mobile_docs" - unison -batch /mnt/nextcloud/Documents "$mobile_docs" + # Rsync from ~/Photos to WebDAV + echo "Syncing Photos from $LOCAL_PHOTOS to WebDAV" + [ ! -d /mnt/nextcloud/Photos/$year/$month ] && mkdir -p /mnt/nextcloud/Photos/$year/$month + rsync -aq $LOCAL_PHOTOS/$year/$month/* /mnt/nextcloud/Photos/$year/$month + if [ -z "$firstrun" -a $lastrun_month -ne $month ] + then + if [ ! -d /mnt/nextcloud/Photos/$lastrun_year/$lastrun_month ] + then + mkdir -p /mnt/nextcloud/Photos/$lastrun_year/$lastrun_month + fi + # TODO: What if we're more than a month behind? + rsync -aq $LOCAL_PHOTOS/$lastrun_year/$lastrun_month/* /mnt/nextcloud/Photos/$lastrun_year/$lastrun_month + fi + + # Rsync from WebDAV to ~/Documents/Mobile + echo "Syncing mobile documents from WebDAV to $mobile_docs" + rsync -aq /mnt/nextcloud/Documents/* "$mobile_docs" + + # Rsync from ~/Documents/Mobile to WebDAV + echo "Syncing mobile documents from $mobile_docs to WebDAV" + rsync -aq "$mobile_docs"/* /mnt/nextcloud/Documents + # Two-way sync for Notes echo "Syncing notes between WebDAV and $notes" unison -batch /mnt/nextcloud/Notes "$notes"