dotfiles

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

commit 75f325e0a4eaa2b353a1d21f49e900c61bd2397f
parent 325c367cec43641aabece26c4b96113ac7106556
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Wed, 14 Feb 2018 06:15:50 -0500

Fix bidirectional syncing in cloudsync.sh

Diffstat:
M.local/lib/cron/cloudsync.sh | 18++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/.local/lib/cron/cloudsync.sh b/.local/lib/cron/cloudsync.sh @@ -52,20 +52,30 @@ then # Rsync from WebDAV to ~/Photos echo "Syncing Photos from WebDAV to $LOCAL_PHOTOS" - rsync -aq /mnt/nextcloud/Photos/$year/$month/* $LOCAL_PHOTOS + [ ! -d $LOCAL_PHOTOS/$year/$month ] && mkdir -p $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? - rsync -aq /mnt/nextcloud/Photos/$lastrun_year/$lastrun_month/* $LOCAL_PHOTOS + if [ ! -d $LOCAL_PHOTOS/$lastrun_year/$lastrun_month ] + then + mkdir -p $LOCAL_PHOTOS/$lastrun_year/$lastrun_month + fi + rsync -aq /mnt/nextcloud/Photos/$lastrun_year/$lastrun_month/* $LOCAL_PHOTOS/$lastrun_year/$lastrun_month fi # Rsync from ~/Photos to WebDAV echo "Syncing Photos from $LOCAL_PHOTOS to WebDAV" - rsync -aq $LOCAL_PHOTOS/$year/$month/* /mnt/nextcloud/Photos + [ ! -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 + rsync -aq $LOCAL_PHOTOS/$lastrun_year/$lastrun_month/* /mnt/nextcloud/Photos/$lastrun_year/$lastrun_month fi # Rsync from WebDAV to ~/Documents/Mobile