Mounting & Unmounting Sync Target

Discuss new features and functions
Posts: 1
Joined: 5 Nov 2022

mrfineppine

Hello Everyone,

This forum and many others have been extremely helpful to me in setting up my sync. I would like to consolidate my findings from numerous threads into one.

Background:
I ran a plex server on an 2014 mac mini that recently took a dive. I used a piece of software called "ChronoSync" to handle the cloning of my main plex media drive. ChronoSync worked well for what I needed it for -- twice a day it would synchronize the drives and throw old versions of files into a directory on the target (Instead of deleting them straight away.)

ChronoSync made the whole process very easy to setup and it was completely hands-off afterward. It would see if the target drive was mounted, if not, it would mount the drive > run the sync > then unmount the drive.

I have a new mini pc, running ubuntu 22.04 LTS. Plex is running great and I believe I have cracked approximating the ChronoSync functionality with FreeFileSync & Cron.

I first setup the sync the way I desired and added a Post Sync command to unmount the drive when complete. I was able to setup cron to mount the drive as a user without using sudo.

To open the user crontab:
crontab -u {username} -e
Now, with the cron job listed below and the Post Sync command, my drive will mount twice a day > 1m later the sync will start > the drive will unmount. All completely hands off. Exactly what I wanted.
#MY USER CRON JOB

#Mount Partition @Midnight & Noon, Everyday
0 0 * * * udisksctl mount -b /dev/{Partition}
0 12 * * * udisksctl mount -b /dev/{Partition}

#Run FreeFileSynch Batch {SyncFile}.ffs_batch @ 1m Past Midnight & 1m Past Noon, Everyday
#{SyncFile}.ffs_batch has <PostSyncCommand Condition="Completion">umount /mount/point/of/your/drive</PostSyncCommand>
1 0 * * * DISPLAY=:0.0 /opt/FreeFileSync/FreeFileSync /path/to/your/{SyncFile}.ffs_batch
1 12 * * * DISPLAY=:0.0 /opt/FreeFileSync/FreeFileSync /path/to/your/{SyncFile}.ffs_batch
This is currently working well for me and I hope it may be of some use to someone else.